[큐/스택] 프린터 (Level 2)

정은경·2020년 4월 4일
0

1. 문제

2. 나의 풀이

def solution(priorities, location):
    temp = []
    count = 0
    for i, v in enumerate(priorities):
        temp.append({i: v})
    # print(temp)

    while temp:
        now = temp.pop(0)
        target = list(now.values())[0]
        if target >= max(priorities):
            priorities.remove(target)
            count += 1
            if list(now.keys())[0] == location:
                return count
        else:
            temp.append(now)

3. 남의 풀이

3-1)

3-2) 파이썬 "any" ?!

3-3) 정렬을 해서 순서를 미리 파악하는 전략!

3-4)

3-5)

Reference

4. 느낀 점

  • 파이썬 "any"에 대해서 알아보자
  • 다양한 풀이 방법들이 있군
profile
#의식의흐름 #순간순간 #생각의스냅샷

0개의 댓글