내 답안
class Solution {
public int solution(int[] num_list) {
int answer = -1;
for(int i = 0; i<num_list.length;i++){
if(num_list[i]<0){
answer = i;
break;
}
}
return answer;
}
}
Java
복사
다른사람 풀이
class Solution {
public int solution(int[] num_list) {
for (int i = 0;i < num_list.length;i++)
if (num_list[i] < 0)
return i;
return -1;
}
}
Java
복사