문제 설명 및 제한사항
아이디어 및 해결 방법
코드
from collections import Counter
def solution(k, tangerine):
cntr = Counter(tangerine)
answer, s = 0, 0
for _, v in sorted(cntr.items(), key=lambda x: -x[1]):
s += v
answer += 1
if s >= k:
return answer
Python
복사
출처
프로그래머스 코딩테스트 연습 https://school.programmers.co.kr/learn/challenges