문제 설명

솔루션
이중 배열은 오랜만
class Solution {
public int[][] solution(int[] num_list, int n) {
int[][] answer = new int[num_list.length/n][n];
int cnt = 0;
for(int i = 0; i < num_list.length/n; i ++){
for(int j = 0; j < n; j++){
answer[i][j] = num_list[cnt];
cnt++;
}
}
return answer;
}
}'java' 카테고리의 다른 글
| [프로그래머스 - 자바] k의 개수 (0) | 2023.08.29 |
|---|---|
| [프로그래머스 - 자바] A로 B만들기 (0) | 2023.08.29 |
| [프로그래머스 - 자바] 모스부호(1) (0) | 2023.08.29 |
| [프로그래머스 - 자바] 중복된 문자 제거 (0) | 2023.08.29 |
| [프로그래머스 - 자바] 합성수 찾기 (0) | 2023.08.29 |