25. Reverse an Array In-Place

You are given an array of integers and its length. Write a function to reverse the array in-place, without using another array.

 

Example-1

Input:  n = 5, arr = [1 2 3 4 5]  
Output: [5 4 3 2 1]

Example-2

Input:  n = 4, arr = [10 20 30 40]  
Output: [40 30 20 10]

 

 

Loading...

Input

5 1 2 3 4 5

Expected Output

5 4 3 2 1