-
프로그래머스 - 명예의 전당 (1)Algorithm 2023. 4. 28. 14:45
문제
풀이
풀고자 했던 의도는 매개변수로 입력 받은 score 배열을 새로운 배열에 하나씩 push하면서 새로운 배열을 정렬시키면서 매 회차마다 k등을 한 점수를 뽑아내 answer 배열에 넣어주는 것이다.
항상 Math.min 메서드나 Math.max 메서드를 사용하면서 깜빡하는 점인데 단순히 숫자들의 연속을 매개변수로 주는게 아닌 number 배열을 매개변수로 주게될 때 스프레드 문법을 사용 해야 한다는 것을 잊어먹는다.
'Algorithm' 카테고리의 다른 글
프로그래머스 - 두 개 뽑아서 더하기 (0) 2023.05.04 프로그래머스 - 덧칠하기 (0) 2023.05.03 프로그래머스 - 다음 큰 숫자 (0) 2023.05.02 프로그래머스 - 짝지어 제거하기 (0) 2023.05.02 프로그래머스 - 추억점수 (0) 2023.04.27