Practice Problems
0% completed
First index of element
Last index of element
Reverse the array
Rotate array
Find the kth largest and smallest element in an array
Sort an array containing 0,1 and 2

Reverse the array

Difficulty: EASY

Problem Statement
Suggest Edit

Given an array with N elements, the task is to reverse all the array elements and print the reversed array.

Input Format:

The first line contains an integer N representing the size of the array.

The second line contains N space-separated integers representing the elements of the array.

Output Format:

The only line of the output prints N space-separated integers representing the Reversed array elements.
1 <= N <= 10^3
1 <= arr[i] <= 10^9
1 <= K < N
Sample Input:
7 5 2 11 2 43 1 10
Sample Output:
10 1 43 2 11 2 5 7
Explanation of Sample Input:
Here the elements have been reversed.
Reset Code
Full screen