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 comment is hidden because it contains spoiler information about the solution
Because you lose information if you mutate the input, you don't know if after your function is called the same argument is passed to another function.
You can always print the input, read this: https://docs.codewars.com/training/troubleshooting/#print-input
For javascript use
console.log(valueYouWantToPrint)
. Your logic about this problem is wrong, it's not you should always backtrack the path you've made, you can go back to the start following a different path.You can always
print()
the input and your output to see what's going on.Instead of a set of instructions, think of it as a grid, follow the different examples and see if you can find a pattern of the ones that return to the original point.