-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnapSchat.java
More file actions
50 lines (45 loc) · 1.17 KB
/
SnapSchat.java
File metadata and controls
50 lines (45 loc) · 1.17 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.util.Scanner;
public class SnapSchat {
public static int MaxStreak(int[]arr){
int currStr = 0;
int maxStr = 0;
int l = 0;
while(l < arr.length){
if(arr[l] == 0){
maxStr = Math.max(currStr, maxStr);
currStr = 0;
l++;
}else{
currStr += 1;
l++;
}
}
return maxStr;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int []arr1 = new int[n];
int []arr2 = new int[n];
for (int idx = 0; idx < arr1.length; idx++) {
arr1[idx] = sc.nextInt();
}
for (int idx = 0; idx < arr2.length; idx++) {
arr2[idx] = sc.nextInt();
}
int a = MaxStreak(arr1);
int b = MaxStreak(arr2);
if(a >b){
System.out.println("Om");
return;
}
else if(b > a){
System.out.println("Addy");
return;
}
else{
System.out.println("Draw");
return;
}
}
}