Reverse an array, up to a a point


Suppose you're given an array, a, as well as a position, p. Write a function to reverse your array, but only up to the position given in p. The rest of your array should remain untouched.

For example, given the following:

a = [1, 3, 4, 6]
p = 2

Your function should return:



Access restricted

Subscribe to premium account to see the solution.

Get premium now