HackerRank Java Arrays- DS
https://www.hackerrank.com/challenges/arrays-ds/problem
- public class Solution {
- public static void main(String[] args) {
- /* Save input */
- Scanner scan = new Scanner(System.in);
- int size = scan.nextInt();
- int [] array = new int[size];
- for (int i = 0; i < size; i++) {
- array[i] = scan.nextInt();
- }
- scan.close();
-
- /* Print elements in reverse order */
- for (int i = size - 1; i >= 0; i--) {
- System.out.print(array[i] + " ");
- }
- }
- }