Ad
  • Default User Avatar

    Have you tried a "array = array.slice()" as first line (directly before your for-loop)?

  • Custom User Avatar

    You're not meant to modify the original array. It's bad practise to modify it because it will change it permenantly and you can't reverse the process.

  • Default User Avatar

    Please look at the kata before you write a comment for a bug.
    The kata has been solved 1436 times! So I think there is no problem.

    Check your code again.

    And do not forget this sentence from the description: "The input array should not be modified!"