156. 2차원으로 만들기

김해준's avatar
Dec 30, 2025
156. 2차원으로 만들기

사용언어 : Java

문제
notion image
풀이
class Solution { public int[][] solution(int[] num_list, int n) { int[][] answer = new int[num_list.length / n][n]; int index = 0; for(int i = 0 ; i < answer.length; i++) { for(int j = 0 ; j < n ; j++) { answer[i][j] = num_list[index]; index++; } } return answer; } }
notion image
Share article