[프로그래머스, 181853] 뒤에서 5등까지 (java)
Problem Solving/Programmers

[프로그래머스, 181853] 뒤에서 5등까지 (java)

728x90

https://school.programmers.co.kr/learn/courses/30/lessons/181853

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr


메모리: 88.2 MB, 시간: 0.50 ms

사용 알고리즘: 구현

import java.util.*;

class Solution {
    public int[] solution(int[] num_list) {
        
        // 정렬
        Arrays.sort(num_list);
        
        // 가장 작은 5개 담기
        int[] answer = new int[5];
        for(int i = 0; i < 5; i++)
            answer[i] = num_list[i];
        
        return answer;
    }
}
728x90