-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay07.java
More file actions
29 lines (23 loc) · 716 Bytes
/
Day07.java
File metadata and controls
29 lines (23 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package HackerRank.CodingDays30;
import java.util.Scanner;
public class Day07 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
int[] countArr = new int[count];
for (int i = 0; i < count; i++) {
countArr[i] = sc.nextInt();
}
// Not the best way, but it works!!!
for(int i = countArr.length-1, j=0; i!=j && i>j; i--, j++) {
int temp = countArr[j];
countArr[j]=countArr[i];
countArr[i]=temp;
}
String output = "";
for (int i : countArr) {
output += i + " ";
}
System.out.println(output);
}
}