Skip to content

Instantly share code, notes, and snippets.

@crissyg
Created July 19, 2017 13:47
Show Gist options
  • Save crissyg/87e26be2089be7546324232ac8201e84 to your computer and use it in GitHub Desktop.
Save crissyg/87e26be2089be7546324232ac8201e84 to your computer and use it in GitHub Desktop.
// Day 7 Hackerrank
/*Description: Given an array,A , of N integers, print 's elements in reverse order as a single line of space-separated numbers.
Input Format
*/
//by crissyg
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr = new int[n];
for(int i=0; i < n; i++){
arr[i] = in.nextInt();
}
in.close();
for(int r=(arr.length-1); r >=0; r--){
System.out.print(arr[r]+" ");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment