본문으로 바로가기
728x90
반응형

문제

 

 

 

728x90

 


풀이

 

 

 

1
2
3
4
5
6
7
8
9
10
11
class Solution {
    public int[] solution(int[] num_list, int n) {
        int[] answer = new int[(int) Math.ceil( (double) num_list.length /n)];
        
        for (int i = 0, j = 0; i < answer.length; i++, j+=n) {
            answer[i] = num_list[j];
        }
        
        return answer;
    }
}
cs

 


반응형

 

728x90
반응형