It sets visited cells to 'W' so it will skip it next time.
This comment is hidden because it contains spoiler information about the solution
Seems like this kata changed description, now it says Given a non-empty array of non-empty integer arrays
Given a non-empty array of non-empty integer arrays
Then you end up with an array of zeros. :-P
What is spiler flag supposed to do in the comment to a solution?
Much more efficient than adding all elements to a list
The next object in the loop
Test cases doesn't consider these ones animals as you can see
You don't need that const and those brackets
It starts the loop at the next index to avoid adding the same town twice.
Let say you have input array equal [50, 100, 70] and a max distance is 30.
The recuresive function will result with 0, but this kata expect null in such scenario.
[50, 100, 70]
Cool, but slow