Ad
  • Default User Avatar

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

  • Custom User Avatar

    The input array should not be modified!

    You're not creating a copy of the array, it's another reference to the same one. Try this to check that:

    arr = [1, 2, 3, 4, 5]
    print(fold_array(arr, 2))
    print(arr) #[9, 6]
    

    When your function is tested the input was already folded once in the previous test, so it's [6, 3, 3] instead, and folding that twice it returns [15].