Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This might shed some light
If it doesn't pass the tests, it doesn't return the right answer. No way it can be different: that's what tests do: compare your output with the expected one and display the corresponding message if they don't match.
Use markdown tags to format your code or it's not usable. Refer to the documentation about this and more: https://docs.codewars.com/training/troubleshooting/#post-discourse
The code you provide is incorrect, it throws a SyntaxError.
I strongly advice you to read carefully this: https://docs.codewars.com/training/troubleshooting/
You don't test the right input.
Remove those calls to your function at the end of your code, that's what's being detected as recursion, not set or repeat.
The index should be in the range [0..length-1]. If it is not, GetNth() should throw/raise an exception
Your code is filtering the mutated list instead of the original one, that's why you get the wrong order.
If the problem is indeed with the returned items' order, you're sorting them incorrectly. I assume your solution relies on
Array.prototype.sort
to be stable which isn't true here. Either way, apart from the issues reported above, everything works correctly. Not an issue.Are you mutating the input? Probably yes, don't do it.
indexOf
returns the first found index of the neccessary letter;Since there are a lot of same letters in the long string tests,
indexOf
returns wrong coordinates of the neccessary letter