-
Notifications
You must be signed in to change notification settings - Fork 0
/
algoCode.java
43 lines (31 loc) · 986 Bytes
/
algoCode.java
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
import java.util.Scanner;
public class spyDetected {
public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int t=scan.nextInt();
while(t!=0){
int k=scan.nextInt();
int kul[]=new int[k];
int ct=0;
int id=0;
for (int i = 0; i < kul.length; i++) {
int j=scan.nextInt();
kul[i]=j;
}
for (int r = 0; r < kul.length; r++) {
for (int i = 0; i < kul.length; i++) {
if (kul[r]==kul[i]) {
ct++;
}
if (ct==1 && i==kul.length-1) {
id=r+1;
System.out.println(id+"\n");
break;
}
}
ct=0;
}
t--;
}
}
}