Problem Description
An array is a simple data structure used to store a collection of data in a contiguous block of memory. Each element in the collection is accessed using an index, and the elements are easy to find because they're stored sequentially in memory.
In computer programming, an array is a collection of similar types of data. For example, if we want to store the marks of 100 people then we can create an array of the integer type that can store 100 marks.
int[] array = new int[100];
The number of values in the Java array is fixed. That is, the above array can not store more than 100 elements.
NOTE:
We can access the element of an array using the index number. Here is the syntax for accessing elements of an array,
// access array elements array[index]
Similarly, we can print the contents of the any ith cell with the following code:
System.out.println(array[i]);
Similarly, we can get the size of any array using the following code:
arrayName.length
Task:
Take N integers as an input and store them in an array and then print the array in reverse format.
Problem Constraints
1 <= N <= 105
1 <= Array Elements <= 109
Input Format
First line contains a single integer N
Next N lines each contains a single integer denoting the array elements.
Output Format
Output N lines denoting the reverse of the inputted array.
Example Input
Input 1:
5 2 1 11 13 14
Input 2:
2 12 11
Example Output
Output 1:
14 13 11 1 2
Output 2:
11 12