Ad
  • Custom User Avatar

    Read the description:

    NOTE on performance: There are no fancy optimizations required, but still the most trivial solutions might time out. Numbers go up to 2^31 ( or similar, depending on language ). Looping all the way up to n, or n/2, will be too slow.

    And that's what your code does, so, no wonder it will fail.

  • Default User Avatar

    The kata works fine in Java (your language). Your code timing out is not a kata issue. You need to write a more efficient algorithm.