Last Updated: 12 Jun, 2023

Reverse an array

Moderate

Problem statement

Given an array ar of n integers, reverse the elements of the array by using the concept of pointers.

Input Format:
Enter a number N and take N more inputs in array ar.
Output Format:
Display values of the reversed array (separated by space)
Constraints
1<= n <=10^6
-10^6<= ar[i] <= 10^6
Note
 You only have to complete the definition of the given function named "reverse". Input has already been taken for you.