Ad
  • Default User Avatar

    I used a mixture of maths and programming to get it to run in <1ms. I think it's running in O(Log(N))

  • Default User Avatar

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

  • Default User Avatar

    Try to do the hard work with maths. I got it working in < 1ms for larger numbers than the solution asks. You don't want to be looping through every number between 1 and the given number.

  • Default User Avatar

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

  • Default User Avatar

    It took me a week to get it, but it was so satisfying! I got it running in 172 microseconds on my PC for 1234567890.

  • Default User Avatar

    There's a more efficient way to do it that's practically instantanious.

  • Default User Avatar

    you can get it to run in under 1ms, but it took me about a week to figure out how.

  • Default User Avatar

    Phew, that took me days to figure out! Got it running in 172 microseconds on my PC for 1234567890. It is possible (without cheating and hard-coding values). Lots of maths.