Ad
  • Custom User Avatar

    The submit test will run a second time ,you can console total to see it .

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.