https://school.programmers.co.kr/learn/courses/30/lessons/42748
Arrays.copyOfRange(array, start - 1, end);
배열, 시작할 위치, 끝날위치
import java.util.*;
class Solution {
public int[] solution(int[] array, int[][] commands) {
int[] answer = new int[commands.length];
for (int i = 0; i < commands.length; i++) {
int start = commands[i][0];
int end = commands[i][1];
int select = commands[i][2];
int[] subarray = Arrays.copyOfRange(array, start - 1, end);
Arrays.sort(subarray);
answer[i] = subarray[select - 1];
}
return answer;
}
}