Skip to content

Commit ae05e25

Browse files
committed
fixes for issue #1 for Monk and lucky
minimum
1 parent fef0c5c commit ae05e25

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
3+
class MonkAndLuckyMinimum {
4+
public static void main(String args[] ) throws Exception {
5+
//Scanner
6+
try(Scanner s = new Scanner(System.in)){
7+
int remainingTest = s.nextInt();
8+
while(remainingTest > 0){
9+
long min=Long.MAX_VALUE,count=0;
10+
for(int sizeOfTest = s.nextInt(); sizeOfTest > 0; sizeOfTest--){
11+
long current = s.nextInt();
12+
if(current<min){
13+
min = current;
14+
count = 1;
15+
}else if (current == min){
16+
count++;
17+
}
18+
}
19+
System.out.println((count%2!=0)?"Lucky":"Unlucky");
20+
remainingTest--;
21+
}
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)