728x90
https://school.programmers.co.kr/learn/courses/30/lessons/120842
📝 나의 풀이
using System;
public class Solution {
public int[,] solution(int[] num_list, int n) {
int[,] answer = new int[(num_list.Length/n), n];
int x = 0;
int y = 0;
for(int i=0; i<num_list.Length; i++)
{
answer[x, y] = num_list[i];
y++;
if(y == n)
{
x++;
y = 0;
}
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | C# | Lv.0] 외계행성의 나이 (0) | 2023.10.05 |
---|---|
[프로그래머스 | C# | Lv.0] 한 번만 등장한 문자 (1) | 2023.10.04 |
[프로그래머스 | C# | Lv.0] 공백으로 구분하기 2 (0) | 2023.10.02 |
[프로그래머스 | C# | Lv.0] 문자열 잘라서 정렬하기 (0) | 2023.10.01 |
[프로그래머스 | C# | Lv.0] 부분 문자열 이어 붙여 문자열 만들기 (0) | 2023.09.29 |