본문 바로가기
Coding Test/Programmers

[Programmers] Lv 1. 명예의 전당(1)

by song.ift 2023. 1. 15.

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

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

 

function solution(k, score) {
    var award = [];

    return score.reduce((a, element) => {
        if (k > award.length) {
            award.push(element);
            award.sort((a, b) => a - b);
        } else if (element >= award.at(0)) {
            award.push(element);
            award.sort((a, b) => a - b).shift();
        }

        a.push(award.at(0));
        return a;
    }, []);
}

GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4/unrated/138477.%E2%80%85%EB%AA%85%EC%98%88%EC%9D%98%E2%80%85%EC%A0%84%EB%8B%B9%E2%80%85%EF%BC%881%EF%BC%89

 

GitHub - developeSHG/Algorithm-Baekjoon_Programmers: 백준 and 프로그래머스 소스코드

백준 and 프로그래머스 소스코드. Contribute to developeSHG/Algorithm-Baekjoon_Programmers development by creating an account on GitHub.

github.com

 

댓글