코딩테스트/[C#] 프로그래머스

[프로그래머스 | C# | Lv.0] 뒤에서 5등 위로

냠냠쿠 2023. 8. 17. 13:53
728x90

 

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

 

 

📝 나의 풀이

using System;

public class Solution {
    public int[] solution(int[] num_list) {
        int[] answer = new int[num_list.Length-5];
        
        Array.Sort(num_list);
        int index = 5;
        
        for(int i=0; i<num_list.Length-5; i++){
            answer[i] = num_list[index];
            index++;
        }
        
        return answer;
    }
}

 

 

 

728x90