def solution(priorities, location):
num_list = [(i,p) for i,p in enumerate(priorities)]
answer = 0
while True:
current = num_list.pop(0)
if any(current[1]<i[1] for i in num_list):
num_list.append(current)
else:
answer += 1
if current[0] == location:
break
return answer
'파이썬 코딩테스트 > 프로그래머스' 카테고리의 다른 글
프로그래머스 / 최솟값 만들기 / 파이썬 (0) | 2022.09.17 |
---|---|
프로그래머스 / JadenCase / 파이썬 (0) | 2022.09.17 |
프로그래머스 / 올바른 괄호 / 파이썬 (0) | 2022.09.14 |
프로그래머스 / 이진 변환 반복하기 / 파이썬 (0) | 2022.09.13 |
프로그래머스 / 최댓값과 최솟값 / 파이썬 (0) | 2022.09.13 |