Ad
  • Custom User Avatar

    It's a double negation. First it negates a false-ish value (nil or false) to true and then negates it false. With this method you have only true or false output and not true, false or nil.

  • Default User Avatar

    I finally figured it all out. I hadn't worked the solution enough, but when I did, I found that I could go a LOT faster.

    Thanks for your input. :)

  • Custom User Avatar

    Solution, which takes 4 second for 10^8 will not pass I believe. It's pretty slow. Time limit on Codewars as far as I know is 6 seconds and the largest value in this kata is 10^9, so your solution will work about 30 second to resolve it. That's why you see timeout exception.

  • Default User Avatar

    I have a solution which I've taken out to [100,000,000!].
    I'm invoking build in Sublime and get the right answers in very short order.

    puts zeros(100000000)# =>
    24999999
    [Finished in 4.0s]

    Running the same process times out the Kata. I can't see how many tests are being done, nor how large the inputs are, so I don't understand my timing issue.
    Anyone have a clue as to the magnitude of the largest test case? I REALLY don't want to give up on this Kata, and I can't see the test cases until I've submitted successfully.

    Argh! :)