-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTransition_Point.java
More file actions
35 lines (32 loc) · 894 Bytes
/
Copy pathTransition_Point.java
File metadata and controls
35 lines (32 loc) · 894 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
30
31
32
33
34
35
package com.company;
import java.io.IOException;
import java.util.Scanner;
public class Transition_Point {
public static void main(String[] args) throws IOException {
//write your code here
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t!=0){
int n = s.nextInt(), temp = 0,flag = 0;
int[] arr = new int[n];
for (int i = 0; i < n; i++){
arr[i] = s.nextInt();
}
for (int i = 0; i < n; i++){
if(arr[i] > 0){
temp = i;
break;
}else{
flag++;
}
}
if(flag == arr.length){
System.out.println("-1");
}
else{
System.out.println(temp);
}
t--;
}
}
}