Ad
  • Custom User Avatar

    Same issue here.. process timing out..

  • Custom User Avatar

    well, as I mentioned before, I added the below tests and code finished in 140ms..

    Test.assert_equals(gap(2, 10000000, 11000000), [10000139, 10000141])
    Test.assert_equals(gap(84, 432560923690632432, 93274782356043246324324), [432560923690633109, 432560923690633193])


    now I added these two, 524ms to finish
    Test.assert_equals(gap(84, 43256092369069327478235604324632432432432, 9327478235932747823560432463243246043246324324), [43256092369069327478235604324632432439529, 43256092369069327478235604324632432439613])
    Test.assert_equals(gap(84, 4325693274782356043246324324092393274782356043246324324690632432, 932932747823560432463243247479327478235604324632432482356043246324324), [4325693274782356043246324324092393274782356043246324324690634993, 4325693274782356043246324324092393274782356043246324324690635077])


    still think my code won't finish within 6seconds for whatever is the given tests?

    I just don't know what is happening

  • Custom User Avatar

    It is posible to do all test cases under 200ms (in JS). So try to write more efficient algorithm. Good luck.

  • Custom User Avatar

    Read the description again, you missed something...

  • Custom User Avatar

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

  • Custom User Avatar

    Process was terminated. It took longer than 6000ms to complete

  • Custom User Avatar

    Could you post exactly what you get? Did you get "Submission timed out" or "Process timed out"?

  • Custom User Avatar

    I added these two tests to already existing 5 tests for 'Run tests'

    Test.assert_equals(gap(2, 10000000, 11000000), [10000139, 10000141])
    Test.assert_equals(gap(84, 432560923690632432, 93274782356043246324324), [432560923690633109, 432560923690633193])

    finished in 140ms


    but when I 'Submit', it times out.. I seriously think script would finish within 6seconds

  • Custom User Avatar

    Try to speed up you search for primes! My solution runs at CW below 700 ms so you should succeed.

  • Custom User Avatar

    Hi,

    Python: I am getting timeout issue.. not sure why

    when I run it on my system with below tests, it takes only <=500ms
    print nextPrime(2,3)
    print nextPrime(20,300)
    print nextPrime(32144322,23452625233)
    print gap(4,100,110)
    print gap(4,30000,100000)
    print gap(2, 10000000, 11000000)
    print gap(2, 100000000, 110000000)
    print gap(2, 10000000000, 11000000000)
    print gap(2, 100000000000, 110000000000)
    print gap(2, 100000000430000, 1100000000056450)
    print gap(84, 432560923690632432, 93274782356043246324324)


    I tried some hacks..

    this fails as expected (None should equal [30109, 30113])
    def gap(g, m, n):
    if n > 11000:
    return None

    while, this times out
    def gap(g, m, n):
    if n > 110000:
    return None

    my script might not be meeting 6sec requirement, but I don't think it should fail like this.. especially as much bigger number on my system does within 500ms..

    any suggestions?