Programmers

[Programmers / Python 풀이] 명예의 전당(1)

Hoo_Dev 2022. 12. 26. 21:07
def solution(k, score):
    answer = []
    lst = []
    for i in score:
        lst.append(i)
        if len(lst) == k and i < min(lst):
            continue
        if len(lst) > k:
            lst.sort()
            lst.pop(0)
        answer.append(min(lst))
    return answer