codegamy_logo

CODELAB

. Reverse the array

You are given an array of integers. Your task is to reverse the array so that the last element becomes the first, the second last becomes the second, and so on. Return or print the array after reversing it.

Input Format

The first line contains a single integer N, the size of the array. The second line contains N space-separated integers representing the elements of the array.

Output Format

Print the reversed array in a single line with space-separated integers.

Sample Input

5 10 20 30 40 50

Sample Output

50 40 30 20 10

Constraints:

1 ≤ N ≤ 10^5 −10^9 ≤ Ai ≤ 10^9
Python
Dark
14

Custom Input

Output

Custom Input

Output

. Reverse the array

You are given an array of integers. Your task is to reverse the array so that the last element becomes the first, the second last becomes the second, and so on. Return or print the array after reversing it.

Input Format

The first line contains a single integer N, the size of the array. The second line contains N space-separated integers representing the elements of the array.

Output Format

Print the reversed array in a single line with space-separated integers.

Sample Input

5 10 20 30 40 50

Sample Output

50 40 30 20 10

Constraints:

1 ≤ N ≤ 10^5 −10^9 ≤ Ai ≤ 10^9
Python
Dark
14

Custom Input

Output

Custom Input

Output

2025 © CodeLab(PSTU) | All Rights Reserved.

Developed by Hasib-17❤️