Ad
  • Custom User Avatar

    Hint: You're not meant to calculate the factorial. Find another way to find the number of zeros.

    n=1000000000 in one of the tests. Calculating the factorial of this number will take an incredible amount of time no matter how fast your computer is. This means this isn't possible to calculate it - try another approach without trying to calcuate the factorial. Hint: try to find a pattern between each factorial.

  • Default User Avatar

    I followed up on this after having this issue, but I think the reply was hidden.

    Put in some debugging and add a timer to cut it off before 7 seconds and you'll see what the issue is.

  • Custom User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

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

  • Default User Avatar

    Same here. My code passes the tests (I added a couple more, including for 100!), but fails on submit with a timeout after 7000 ms. I checked it on my PC with time.clock() on a loop from 1! to 100! and the result was few miliseconds.

  • Default User Avatar

    Are you using python? I had the same issue you are reporting with the python test case is because the test is passing the same array to both the function and the validation since it should be the same. I was actually changing that original array and returning a new one, and it validated the new array againt the one I changed.

    Technically, that's a feature of python that the array passed to function is not being copied but being changed globally. But for the cleanliness of the test, it should probably be tested against a different array.

  • Default User Avatar

    Can't submit with python

    I can pass any test case I write quickly, but when I submit to test with official cases, it times out at 7000ms no matter what. I changed the funtion back to just return 0 and it returns an unknown error instead of a fail.