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.
Submitted this same solution and it didn't work.
Hi muges,
Sorry, missed you reply.
I've found an issue, I've forgotten to clone the tested array for actual and expected methods.
It's not needed for other languages because expected method is executed first.
But for JS it differs. Assert.equals(actual, expected) - actual ans expected are swapped.
Unfortunately I can't change my tests as it's blocked by the site once more then 1000 users pass it.
But you can change your solution by adding
a = a.slice(0)
to the first line of your method.Thanks for spotting it.
~Cheers
Hi muges,
I aggree that all provided by you array should return 1, 2, 2 accordingly,
But I've double cheked the code and didn't find any issues.
js tests show results in the next format: Expected: 7, instead got: 1 and you can't actually see the tested array of input/random data.
If you want you can provide me your solution (marked spoiler) and I can check it too.
This comment is hidden because it contains spoiler information about the solution