프로그래머스/Lv.0
[프로그래머스 C#] n개 간격의 원소들
suniverse
2023. 9. 3. 15:27
using System;
using System.Collections.Generic;
public class Solution {
public int[] solution(int[] num_list, int n) {
List<int> answer = new List<int>();
for(int i = 0; i < num_list.Length; i += n)
{
answer.Add(num_list[i]);
}
return answer.ToArray();
}
}