import java.util.*;
class Solution {
public int[] solution(int[] array, int[][] commands) {
int[] answer = new int[commands.length];
int i, j, k = 0;
int add=0;
int index=0;
for(int r=0; r< commands.length; r++){
i= commands[r][0];
j= commands[r][1];
k= commands[r][2];
int[] temp = new int[j-i+1];
for(add=0; add<3; add++){
for(int t= i-1; t<j-1; t++){ // t <j로 하면 배열 인덱싱 에러가 뜹니다ㅜ
temp[add] = array[t];
}
}
Arrays.sort(temp);
answer[index++] = temp[k-1];
}
return answer;
}
}
i,j,k변수는 의미가 있는 변수인데 이름을 저렇게 지으셔서 가독성이 떨어져 해석하기가 너무 힘드네요...
이런습관은 고쳐주세요...(타인은 둘째치고 나중에 프로그램 수정이 필요할때 본인도 힘들어집니다)