Reverse an Array
Easyjavapythonccppjavascript
Given an array of N integers, reverse the order of its elements.
Input Format
The first line contains an integer N. The second line contains N space-separated integers.
Output Format
Print the N elements in reverse order, separated by single spaces, on one line.
Example 1
Input
4 1 2 3 4
Output
4 3 2 1
Explanation: The first element becomes the last, and so on.
- 1 <= N <= 100000
- -1000000000 <= A[i] <= 1000000000