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.
That mean you can move elements in array, but only by 2 position - e.g. if you have
{1,2,3,4}
, you can move 1 and you will get{2,3,1,4}
, not{2,1,3,4}
.Added image to description, hope it will help, thanks for feedback.
Nice kata, differs from other that dont accept leading zeros.
You have probably find a wrong pattern and thats why are you having this issue. Good luck with solving!
Maybe emphasize that the numbers should be substrings of N, when i read it quick first time, i thought i should test numbers from 1 to N.
There should be array with different lenght, not just 3 ;)
reduce doesn't do exactly what you think ;)
It is posible to do all test cases under 200ms (in JS). So try to write more efficient algorithm. Good luck.
This comment is hidden because it contains spoiler information about the solution
Javascript translation created.
Nice O(1) space solution
You always have to deal with wrong input values, even if they don't make sense. At my university quarter of all test cases are just handling bad inputs.
It's good for beginners.
try throw new Error() instead of raise Exception()
Yes, now its great!
There is no solution setup, which is not clear.
Loading more items...