[프로그래머스/Java] Lv.0 뒤에서 5등 위로

febCho·2024년 3월 18일
0

코딩테스트

목록 보기
101/253
post-thumbnail

문제

정수로 이루어진 리스트 num_list가 주어집니다. num_list에서 가장 작은 5개의 수를 제외한 수들을 오름차순으로 담은 리스트를 return하도록 solution 함수를 완성해주세요.

- 제한사항

  • 6 ≤ num_list의 길이 ≤ 30
  • 1 ≤ num_list의 원소 ≤ 100

풀이

import java.util.Arrays;

class Solution {
    public int[] solution(int[] num_list) {
        Arrays.sort(num_list);
        int[] answer = Arrays.copyOfRange(num_list, 5, num_list.length);
        
        return answer;
    }
}

결과

profile
Done is better than perfect.

0개의 댓글