Given an array
arr[]
of size
n
, write a program to
reverse the array
.
Example 1
Input: arr[] = [1, 2, 3]
Output: arr[] = [3, 2, 1]
Explanation: On reversing the array, the last element becomes the first and vice-versa.
Example 2
Input: arr[] = [4, 5, 1, 2]
Output: arr[] = [2, 1, 5, 4]
Explanation: On reversing the array, the last element becomes the first and vice-versa.