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.
I think that the cast as int invalidated this solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You are right, then just need to add an
if
or use themax
function to have a lower bound.Because when you remove two items ,it can only affects the surrouding items (old left and old right). While here they start searching from the beginning of the list.
For example if you have
N, N, N, N, E, W, S
when you delete E and W you dont need to go to the beginning but at the last N which was the left of the removed items.I think that the second
i = 1
at line 6 can be replaced byi -= 1
thanks for reporting issue, I added the random tests.