Ad
  • Custom User Avatar

    Thanks for the second answer. I created a copy of the array to work on and it works now.

  • Default User Avatar

    Please google
    "IndexError: list index out of range".

    Secondly, don't mutate the array.

  • Custom User Avatar

    I honestly don't know. I mean, I do iterate over the array, but as far as I can see, I catch all the border cases. I've even written some extra tests for these cases(empty array, array of only same numbers, array of increasing numbers etc.), but they all run through smoothly. The whole error message reads a little as if there was a problem with the reference solution, but I'm not sure.

    Traceback (most recent call last):
    File "main.py", line 31, in
    Test.assert_equals(solve(arr),solve_Uyx2(arr))
    File "main.py", line 21, in solve_Uyx2
    res = []; t = arr[-1]; res.append(t)
    IndexError: list index out of range

  • Custom User Avatar

    Why do you think you get this error?

  • Custom User Avatar

    Hey guys, my basic tests all run through, but when I attempt the random tests I get the following error:
    IndexError: list index out of range
    Anyone else had this issue?