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.
The submit test will run a second time ,you can console total to see it .
I added a attribite on nodes at first,just like node.isVisit = node.isVisit || 1, to mark node is whether being visited.But I failed.At last I find out that the method you wrote will be run a second time ,maybe just like youMethod(node);return yourMethod(node);.So if you define a node.x on it,and use if(!node.x) to do the loop,probably you will get wrong answer without any wrong tips.It will only tell you that you answer is not expected.By knowing this,I finally solve this kata by adding attribite in a minimum loop time.Then I think maybe the author just dont want us to add anything to the nodes to solve the kata , just like the rabbit and the turtle .It's so funny.
I was trying using a Bubble sort to solve this case ,and I do not thing when ages are equals,but still couldn't pass it.Then I used console.log to see the origional array and the correct answer,found out that it did changed order when ages are equals sometimes which is different from the origional ones.