Ad
  • Custom User Avatar

    There are 20000 JS tests in total, your code handles about half of them, I have run it several times - the result is 10_000 - 12_000. To be honest, I haven't looked closely at your code and can't tell you exactly what the problem is, but your algorithm needs to be improved. However, before you change anything, maybe you can add caching for some “heavy” calculations (if there are any and it is possible), it might work.

  • Custom User Avatar

    I managed, not without difficulty, to find a solution to this Kata!
    But I can't get past the random tests...
    Code Wars gives me a timeout before the tests are finished.
    I didn't use a brute force algorithm; the algorithm solves a puzzle in an average of 1ms, so I don't know what more I can do...
    (Tests done in JS.)

  • Custom User Avatar

    I think it's because of the asynchronous nature of my tests, but I don't know how to fix it... Does anyone have any ideas?

  • Custom User Avatar

    Thank you for the feedback. The issue has been resolved.

  • Custom User Avatar

    The initial solution has function twoOldestAges.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution