Ad
  • Default User Avatar

    I like it Phil! Certainly better than mine. :)

  • Default User Avatar

    Thanks for the tip and the interesting kata! I've worked on this off and on for the last few weeks and it feels good to finally solve it :)

  • Custom User Avatar

    You need a solution faster than O(n).

    Edit: Wait, if you can pass the 7th test (the test with very big numbers) it should already be faster than O(n). In that case I guess it's due to some edge cases triggering infinite loop?

  • Default User Avatar

    Thanks for taking a look. It passes the sample tests in 0.026472ms but now I get the 12 second duration error message. Is my algorithm still too slow?

  • Custom User Avatar

    Okay, now I see what's the problem. Fixed.

  • Default User Avatar

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

  • Custom User Avatar

    It might have to do with how you dealt with the Debug switch.

    Can you post your code in the reply (with spoilers)?

  • Default User Avatar

    I'm using C# and I have a solution that passes the example tests. However when I attempt the kata it says there were three compilation warnings like:

    /home/codewarrior/fixture.cs(48,6): warning CS0162: Unreachable code detected

    Any idea what would cause this? I am using a second function and I have included a second "using" at the top. All of the code is reachable (as I said it passes the example tests just fine) but I don't know exactly how it is run on the server. Is there something I need to watch out for when working with C# on codewars.com?