
Algorithm/프로그래머스
[알고리즘] n개 간격의 원소들 Java
import java.util.ArrayList; import java.util.List; class Solution { public int[] solution(int[] num_list, int n) { List list = new ArrayList(); for (int i = 0; i < num_list.length; i += n) { list.add(num_list[i]); } return list.stream().mapToInt(Integer::intValue).toArray(); } }