6 kyu
Ranking System
584 of 1,107tostaylo
Loading description...
Fundamentals
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.
python new test framework is required. updated in this fork
Approved
SORRY!! I have accidentally mangled the sample tests. Can you reset them please. I have a one-line solution that works with PyCharm, and I wanto to test it on your data. Thank you!
You an click the RESET button at the bottom to reset sample tests and solution to their initial form. Back up your solution, click RESET to restore tests, and paste your solution back.
input // [1,3,2] output // [3,1,2]
Man... Why ? You said in the statement that the highest number get the first place, and the lowest the last. Why is the lowest value at index 1 instead of 2 ? I really don't understand.
I took a good ten minutes figuring out why [1,3,2] became [3,1,2]. Sighed.
This is almost a clone to this one https://www.codewars.com/kata/545f05676b42a0a195000d95 Nice kyu.
Hello. After I click 'Attempt' it is expecting a sorted array no matter what. For example Expected: '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]', instead got: '[9, 17, 3, 16, 10, 1, 15, 7, 8, 12, 13, 2, 4, 11, 5, 14, 6]', although the expected array is not the correct one. Can you check please?
You're mutating the input array, affecting the expected values.
Thank you. It worked now!
Not a kata issue then. Closing.
I'm not sure if there should be a warning about not mutating the input, getting the expected value first/passing a copy to the user or doing nothing and leaving it as it is. Wondering about the downvote on my previous post, I see no reason for it, but, there's nothing I can do about it.
Doing testing invulnerable to input modification is definitely better kata design ( and explicitly failing solutions that modify inputs is better still ). But ultimately solvers are responsible for not mutating their inputs themselves ( or - yes I sound like a broken record; it's as tiresome to me as it probably is to you - you deserve whatever you get ). A warning should not be necessary, but it might prevent most of the endless f*cking issues by solvers who are still learning this ( generously deleted "clueless" here ).
I'm not seeing that downvote BTW. I ( though I ) had one earlier on my post below, but I'm not seeing it now either.
Updated the test cases for javascript so that mutation of input data is allowed.
Thanks jamad.
Speeling error:
updated the description on behalf. Thanks.
Translated it into Python.
See the issue above, plz.
Updated the test cases for python so that mutation of input data is allowed.
I think the tests may be wrong. When the test is the following:
[ 16, 83, 3, 69, 31, 27, 73, 49, 9, 99, 93, 22, 70, 32, 98, 29, 36, 6, 38 ]
I get the following result:
Expected: '[19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]', instead got: '[16, 4, 19, 7, 12, 14, 5, 8, 17, 1, 3, 15, 6, 11, 2, 13, 10, 18, 9]'
do you mutate the input?
Same error without modifying the input in JS :
[ 19, 72, 16, 50, 25, 92, 80, 23, 40, 63, 26, 99, 42, 18, 68, 3, 75, 96 ]
Expected: '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]', instead got: '[15, 6, 17, 9, 13, 3, 4, 14, 11, 8, 12, 1, 10, 16, 7, 18, 5, 2]'
Yes, the random tests are vulnerable to input modification. No, if you do not modify the input the tests are not wrong. Yes, if you modify the input you deserve whatever you get.
Note that
[].sort
modifies its input.Not a kata issue. Closing.
Thanks for kata!PHP translation