-> 자세한 내용 보러가기
import java.util.*;
class Solution {
public int[] solution(int[] array, int[][] commands) {
int[] answer = new int[commands.length];
int idx = 0;
for(int[] command : commands){
int i = command[0] - 1;
int j = command[1] - 1;
int k = command[2] - 1;
int[] copy = Arrays.copyOfRange(array, i, j + 1);
Arrays.sort(copy);
answer[idx] = copy[k];
idx++;
}
return answer;
}
}