You will be given an array and your goal is to reverse it.
reverseArrayInPlace(arr)
should return the origin arr
reversed.
There are some conditions:
- be sure to manipulate the array passed in.
- don't push elements into a new array and return that array.
- don't use
Array.reverse()
method.
Example:
reverseArrayInPlace([1, 2, 6, 3, 5, 0]) // [0, 5, 3, 6, 2, 1]