해피 코딩!

[프로그래머스] 프린터 본문

알고리즘

[프로그래머스] 프린터

지속가능한 성장을 2020. 12. 12. 07:03

link

def solution(priorities, location):
    answer = []
    lst = [i for i in range(len(priorities))]

    while priorities:
        if priorities[0] == max(priorities):
            answer.append(lst.pop(0))
            priorities.pop(0)
        else:
            lst.append(lst.pop(0))
            priorities.append(priorities.pop(0))

    return answer.index(location)+1

'알고리즘' 카테고리의 다른 글

[백준] 블랙잭 2798번  (0) 2020.12.12
[백준] 덩치 7568번  (0) 2020.12.12
[프로그래머스] 주식가격  (0) 2020.12.12
[프로그래머스] 완주하지 못한 선수  (0) 2020.12.12
[프로그래머스] 모의고사  (0) 2020.12.12
Comments