https://school.programmers.co.kr/learn/courses/30/lessons/42748
import java.util.*;
class Solution {
public int[] solution(int[] array, int[][] commands) {
int length = commands.length;
int[] answer = new int[length];
for (int i = 0; i < length; i++) {
int tl = commands[i][1] - commands[i][0] + 1;
int[] temp = new int[tl];
for (int j = 0; j < tl; j++) {
temp[j] = array[commands[i][0] + j - 1];
}
Arrays.sort(temp);
answer[i] = temp[commands[i][2] - 1];
}
return answer;
}
}