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.
consider that our string is "youuusddef"
the validation at if statment checks if the current iteration 'y' equals to the the next one 'o' ? if false we do not do anything because the effect takes on the original string (s) as we returns it at the end, but if true (the if statement, like when reaching u equals the next one u, so the body of the if statement do erasing the current iteration which is 2 ( 0 - 1 - 2 => s[2] = u) but then our string length will be "youusddef" and it's length will be decrmented by 1, so we'll have to delete the same position because the other (u) toke the removed (u) place (when removing a character the other character will move to left to close the gap), so our string will be "yousddef", there i'm resetting the loop to start from the begining (but it's not the best solution we could make the iteratin before the first u to avoid starting from the begining) by making i = -1 so that being incremented at the for loop statement by one so it will be 0, there i made the loop starts from the first iteration again, and so on repeating the operation till catching anther double value and takes the same effect, etc, till the string ends.
This comment is hidden because it contains spoiler information about the solution