Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

Baro's B

2차원으로 만들기 본문

알고리즘

2차원으로 만들기

Baro_forest 2023. 2. 22. 23:42

 

코드

class Solution {
    public int[][] solution(int[] num_list, int n) {
        int[][] answer = new int[num_list.length/n][n];
        int count = 0;
        
        for(int i = 0; i< num_list.length/n; i++) {
            for (int j = 0; j < n; j++) {
                answer[i][j] = num_list[count];
                count++;
            }
        }
        return answer;
    }
}

'알고리즘' 카테고리의 다른 글

공던지기  (0) 2023.02.22
점의 위치 구하기  (0) 2023.02.22
가위 바위 보  (0) 2023.02.18
모스부호(1)  (0) 2023.02.18
개미 군단  (0) 2023.02.18