#K91952. Reverse an Array

    ID: 38089 Type: Default 1000ms 256MiB

Reverse an Array

Reverse an Array

You are given an array of integers of length \(N\). Your task is to reverse the order of the elements in the array.

Input: The input begins with a single integer \(N\), indicating the number of elements in the array, followed by a line containing \(N\) space-separated integers.

Output: Output the reversed array as a single line of space-separated integers. If the array is empty (i.e., \(N = 0\)), output an empty line.

Example:

For input: 5
10 20 30 40 50

the output should be: 50 40 30 20 10

inputFormat

The first line contains an integer \(N\) (the number of elements in the array).
The second line contains \(N\) space-separated integers representing the array.

outputFormat

Output a single line with the \(N\) integers of the reversed array, separated by spaces. If \(N = 0\), output an empty line.

## sample
5
10 20 30 40 50
50 40 30 20 10