728x90
https://school.programmers.co.kr/learn/courses/30/lessons/181888
📝 나의 풀이
using System;
public class Solution {
public int[] solution(int[] num_list, int n) {
int[] answer;
if(num_list.Length%n==0){
answer = new int[num_list.Length/n];
} else {
answer = new int[(num_list.Length/n)+1];
}
int index =0;
for(int i=0;i<num_list.Length; ){
answer[index] = num_list[i];
index++;
i = i+n;
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | C# | Lv.0] 순서쌍의 개수 (0) | 2023.08.24 |
---|---|
[프로그래머스 | C# | Lv.0] 문자열로 변환 (0) | 2023.08.23 |
[프로그래머스 | C# | Lv.0] 숫자 찾기 (0) | 2023.08.22 |
[프로그래머스 | C# | Lv.0] 피자 나눠 먹기 (1) (0) | 2023.08.22 |
[프로그래머스 | C# | Lv.0] 369게임 (0) | 2023.08.21 |