• Custom User Avatar

    Your code will fail with nested loops. You need to find a more efficient way to compute the answer. Nobody should give you any formula, that would be giving the solution.

  • Custom User Avatar

    This kata can be solved without applying special formulas from Numberphile video. It is just for educational purposes. Try to come up with something "easier"

  • Custom User Avatar

    Even numbers do not need special handling.

  • Custom User Avatar

    (message deleted cause I'm not sure it's right...)

  • Custom User Avatar

    hahah and i think why pop and shift doesnt work :D

  • Custom User Avatar

    Your answer is running in O(n^2) time! The outer for loop is the first "n", but your call to Array.indexOf() does another linear search through the array for a second "n" search, increasing the time by quite a lot!

    I recommend searching online for some of the Kata tags for clues :)