K번째 수
-
Level1) K번째 수PS/programmers 2020. 9. 8. 13:06
import java.util.ArrayList; import java.util.Arrays; class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; ArrayList list = new ArrayList(); for (int c = 0; c < commands.length; c++) { int i = commands[c][0]; int j = commands[c][1]; int k = commands[c][2]; int[] arr = Arrays.copyOfRange(array, i - 1, j); Arrays.sort(arr); answer[c] = arr..