4 kyu
Miracle Sort
78ZED.CWT
Loading description...
Puzzles
Sorting
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Link in description have content removed.
But I found it here:
https://www.reddit.com/r/ProgrammerHumor/comments/ba55q2/i_present_you_the_miracle_sort
Thanks to the author @ZED.CWT! I learned something new and interesting
This comment has been hidden.
ez
is it possible to get a hint?
ECMA-262 is always your friend ;-)
Wasn't much help. ecma is huge. but thanks anyways.
There are only 17 lines of codes, you do not need to walk through the whole spec.
still could not find it. guess ill keep looking
This comment has been hidden.
You are in the correct direction
.
.
Approved ;-)
WOW. THX. o_O
Hello
Some problem with your kata:
; ) )
Sorry for my poor explaintion. The code is wrote by a poor guy and you are the god. So you are not helping the guy by changing the code but do some stuff else, which is why i put it in the test part. (I think i may need to clearify that it is a hacking game) The time checking part in the code is only used to reduce the default 12s timeout
Does it mean the aim of the kata is to modify the code inside your Tests ? Cause when a solution fails on a 5 long array I think there's something wrong in your tests.
; ) )
Nope. The miracleSort function in the final test is complete the same as the one in the example test. How did you fail on 5 long arrays,
passed the first four and failed the fifth one?passed some long arrays and failed on one or not passing any long arrays?So if The miracleSort function in the final test is complete the same as the one in the example test. then the kata can't be solved 'cause you're testing the function you keep in your test suite. If you want people be abled to solve the kata you should test function people have coded in "Solution" pane not the function bugged function you keep in your code.
eg try :
you're testing the function you keep in your test suite That is true and designed on purpose. People do not re-implement the miracleSort function but hack to make the function work. And again, the perfomance does not matter. I just do not want people to wait till 12s if they failed to hack.
When I talked of a '5 long array' I mean 'an array of only five items' like
[3, 4, 5, 6, 7]
in first test. The right sorted array is returned but your test throw error due totimeout
. What kind of timeout may occur on such an array ?I tried to guess some possible situations but not able to image what really happended. May you provide your solution?
This comment has been hidden.
Yes you implemented a sort function, that is half of this kata. But the tests will still call its own miracleSort, which caused the timeout error. So the other half is about finding a way to inject your code when miracleSort being called. Have your solution passed the original example tests (without modifying it)?
So the kata is clearly not about "sorting" !
@ZozoFouchtra
Clearly you need to attempt these two katas first:
https://www.codewars.com/kata/tap-into-mr-mxyzinjins-matrix https://www.codewars.com/kata/tap-into-mr-mxyzinjins-brain
;-)
So the kata is clearly not about "sorting" ! Yes, and that is why i did not tag it with
bug-fix
.@Voile Thanks goodness it is a better way to explain the purpose of this kata.
This comment has been hidden.