K번째수

suhan cho·2022년 8월 13일
0
int[] answer = new int[commands.length+1];
        int first =0;
        int second =0;
        int third =0;

        for(int i=0; i<commands.length; i++){
            first = commands[i][0];
            second = commands[i][1];
            third = commands[i][2];

            int[] arr = Arrays.copyOfRange(array, first-1, second);
            Arrays.sort(arr);
           // for(int x : arr) System.out.println(x);


            System.out.println(arr[third-1]);
            answer[i] = arr[third-1];
        }
  • copyOfRange();
profile
안녕하세요

0개의 댓글