4 kyu

Don't give me five! Really!

68 of 459zappa78
Description
Loading description...
Algorithms
Mathematics
Performance
  • Please sign in or sign up to leave a comment.
  • 0legCH Avatar

    I really hate this kata. It takes me 2 weeks to complete it.

  • Eatkin Avatar

    I've got an off-by-one error in SOME test cases with seemingly no consistency. How can I come so far and have this happen? The worst thing is I can pass the 100,000 big numbers but for some reason not the 10,000 big numbers nor the 1000 big numbers.

    Edit: It's been 3 weeks, I came back, now I can pass everything EXCEPT 100,000 big numbers.

    5 minutes later edit: I DID IT!! My problem was some awkward dealings with start numbers not being inclusive in some certain circumstances. Goddamn longest I've ever spent on a kata but at least it'll stop annoying me that I haven't been able to solve it now. 4500ms too which is pretty good I think?

  • rafa.mukha Avatar

    Tnx all! I'm very enjoy it!

  • Conrad_123 Avatar

    I struggled too solve this and then struggled too make it fast ennough too pass, but very rewarding!

  • Stonegrip Avatar

    This comment has been hidden.

  • solarlogos Avatar

    i like this and really wonder where is my mistake, it works fine for small and larger numbers but my abstraction for huge numbers just wont match... even when i "manually calculate", my results are way bigger than the expected ones... hope one day i´ll solve this

  • MohamedAlaa0100 Avatar

    Lol i just write loop without do anything and it tell me Timed Out (12000 ms)

    the faster loop in js :V >> while (start <= end){}

  • KirillVelichk0 Avatar

    When I wrote this code, it took a very long time for my solution to come up against the time check. On my laptop, it took about 11 seconds to run 10 million random tests, but on the server, it didn't make it in 12 seconds. I decided to rewrite one function, figuring that the program could potentially speed up by half. As a result, the program ran 100 times faster. The execution time for 10 million tests became about 100,000 milliseconds. On the one hand I'm glad that it worked, but on the other hand I have absolutely no idea what the reason is for this acceleration.

  • Jurr Avatar

    First of all: I absolutely love this kata. On the surface it seems so simple... but its surface conceals many, hidden complexities. Thank you @zappa78!

    Unfortunately I also feel something is wrong with the Javascript variant, just like @zhirnov-d and @Iluxmas remarked 4 days and 17 days ago. Perhaps due to an update, as @Iluxmas suggested?

    I have written quite a performant algorithm (tests complete in 733ms, that's even about 16 times faster than @Iluxmas), but still I get remote timeouts. While remotely all '10000 big numbers' and all '100000 big numbers' pass, the final category '1000000 big numbers' times out.

    I came to believe that something is wrong because of three reasons:

    1. the purpose of this kata, I would guess, is to write an algorithm that does not have a liner time complexity O(n), but has logarithmic time complexity. After all, that's what the description says: it was inspired by the other kata that could be solved with a O(n) loop. If this was the test, I have passed.
    2. Remotely, I pass almost all tests, just the last category fails. Hence it seems to be a minor tweak (not a fundamental problem) that causes the fail.
    3. The remarks of others, who have also been experiencing issues recently.

    What do you think of this, @zappa78?

    I will try to share my solution in a comment to myself, so that I can set a spoiler flag.

  • Iluxmas Avatar

    Hmmm, all test are green and "Completed in 11665ms" but below is written "Execution Timed Out (12000 ms)" :[

  • zhirnov-d Avatar

    Javascript, all my relatively fast solutions failed due to time out so I gave up and unlocked submitted solutions. To my surprise all approved solutions I checked also timed out. I tried FF and Chrome on Windows and Ununtu machines just to be sure. What might be the problem?

  • prgpascal Avatar

    Damn, it was tough but I finally completed it! Absolutely a good Kata, many thanks to the author

  • depial Avatar

    Julia translation Please review and approve

  • mohrizkyk Avatar

    gosh, it's so hard.

    is it mathematically possible?
    or efficient iteration is the only way?

  • morozhenka48 Avatar

    This comment has been hidden.

  • 001kvash Avatar

    It takes me 499ms on a test, but on attempt it fails due to time out. What could be wrong?

  • Rajczo Avatar

    This comment has been hidden.

  • RealKenshiro Avatar

    Very cool kata. A performance tag should be added.

  • matheusmaia103 Avatar

    I think I am having timeout error because of the huge numbers part, my code isnt long and I think it is efficient. It passes trhough all the other tests but when it gets to the last part I get the time error.

    Im doing itt on JS btw

  • dfhwze Avatar

    This comment has been hidden.

  • lopared Avatar

    approved!

  • lopared Avatar
  • lopared Avatar

    Python should use snake_case instead of camelCase for function names.

  • monadius Avatar

    CommonLisp: there should be no warnings when running tests:

    ; file: /workspace/challenge/tests/solution.lisp
    ; in: DEFUN CHALLENGE/TESTS/SOLUTION::CONTAINED-FIVES-SOLN
    ;     (SETQ CHALLENGE/TESTS/SOLUTION::D (MOD CHALLENGE/TESTS/SOLUTION::N 10))
    ; 
    ; caught WARNING:
    ;   undefined variable: CHALLENGE/TESTS/SOLUTION::D
    ...
    

    All variables should be properly declared.

  • seleemdz Avatar

    This comment has been hidden.