내 답안
class Solution {
public int[] solution(int[] arr, int[][] queries) {
for (int[] query : queries) {
int start = query[0];
int end = query[1];
for (int i = start; i <= end; i++) {
arr[i] += 1;
}
}
return arr;
}
}
Java
복사
다른 사람 풀이
class Solution {
public int[] solution(int[] arr, int[][] queries) {
int[] answer = {};
for(int i=0; i<queries.length; i++){
for(int j=queries[i][0]; j<=queries[i][1]; j++){
arr[j]++;
}
}
return arr;
}
}
Java
복사