Ad
  • Custom User Avatar

    @gribskov: if your solution takes 240 ms per test then the total time will be more than 800ms. Or, if your solution is too slow overall you won't see the total time it took, only the successful tests up to that point are shown.

  • Custom User Avatar

    My O(N) approach (that does not involve any data structures) can pass all tests in Python but not in JavaScript.
    In JavaScript, my code cannot pass the test case with an array of 999999 elements. I got this error:

    You code is too slow ;-): expected '31ms' to equal 'Less than 6ms per testcase'.

  • Custom User Avatar

    according to CCPThugHunter 800ms should be sufficient for all tests. My code runs in 240ms, but is not accepted

  • Custom User Avatar

    Yep, 0 is correct. When you target an index to then count to the left and right, the value stored on that index is left out meaning that at index 0, you ignore the 20 which leads to sums of 0 on both left and right.

  • Custom User Avatar

    I see where you found the 0 sum at index 0. That is just confusion. You won't get to 0 anymore if you don't count into the left and right sums the number at the target index.

    So, counting the -1 at index 0 which is incorrect gets you 0 to the left and 1 to the right.

    Index 2 is correct in the end.

  • Custom User Avatar

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

  • Custom User Avatar

    Strange, it worked here. Tested with the above solution and 'tThe Holy Bible' correctly results in 'BbeehHillotTy'. Had to update the test as well to account for the 't'.

  • Custom User Avatar

    Hi, the solution will pass only if you find a way to solve the problem without loops. as wrotes below in the comments inList numbers are sequentially from 1 to n this should help you to solve the problem without loops

  • Custom User Avatar

    So what kind of time should we achieve for the random tests? I get times in the 240 usec range but still fail

  • Custom User Avatar

    This doesn't answer my question. What response time are you expecting to not fail the time test.

  • Custom User Avatar

    You are right. I was able to pass them with your solution and some other I didn't try before from the solutions page. Your reasoning makes sense. Thanks for checking it out sayan warrior.

  • Custom User Avatar

    The tests are not broken. I just passed both Python and Javascript versions, the tests work fine.

    It is possible that the kata has been updated which has caused some old solutions to be too slow on the latest language version, but the kata is still quite possible.

  • Custom User Avatar

    !!! TESTS ARE BROKEN !!!

    Tried multiple solutions and couldn't get the execution time to be accepted,

    INCLUDING the ones from the solutions page after skipping the kata

    Tests still failed due to long execution time.

  • Custom 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

  • Loading more items...