๋ฌธ์
https://school.programmers.co.kr/learn/courses/30/lessons/42587
ํ์ด
# ํ๋ก๊ทธ๋๋จธ์ค 2๋จ๊ณ - ํ๋ฆฐํฐ
def solution(priorities, location):
answer = 0
from collections import deque
d = deque([(v,i) for i,v in enumerate(priorities)])
print(d)
while len(d):
item = d.popleft()
if d and max(d)[0] > item[0]:
d.append(item)
else:
answer += 1
if item[1] == location:
break
return answer
solution([2, 1, 3, 2],2)