2021.03.07 연습

 

  • 사용언어 : java
  • 프로그래머스 K번째수

 

import java.util.Arrays;

class Solution {
    public int[] solution(int[] array, int[][] commands) {
        int[] answer = new int[commands.length];
        
        for (int t = 0 ;  t < commands.length ; t ++) {
            int[] tmp1 = Arrays.copyOfRange(array,commands[t][0]-1 , commands[t][1]);
            Arrays.sort(tmp1);
            answer[t] = tmp1[commands[t][2]-1];
        }
	    
	    return answer;
    }
}

정확성: 100.0
합계: 100.0 / 100.0