class Solution {
public int[] solution(int[] arr, int[][] queries) {
for (int i = 0; i < queries.length; i++) {
int s = queries[i][0];
int e = queries[i][1];
int k = queries[i][2];
for (int j = s; j <= e; j++){
if (j % k == 0 ) {
arr[j] += 1;
}
}
}
return arr;
}
}
๋ฌธ์ ๋ง ์ ์ดํดํ๋ฉด ์ฝ๊ฒ ํ ์ ์๋ค.
arr[i] ๊ฐ์ด ์๋ ์ธ๋ฑ์ค i ๊ฐ๊ณผ ๋น๊ตํด์ผํ๋ค๋ ์ ๋ง ์ฃผ์ํ๋ฉด ๋๋ค.