반응형
programmers.co.kr/learn/courses/30/lessons/42587
def solution(priorities, location):
n = len(priorities)
cur = 0
answer = 0
while True:
m = max(priorities)
for i in range(cur, cur+ n):
j = i % n
if priorities[j] == m : # find max
answer += 1
if j == location:
return answer
cur = j
priorities[j] = 0
댓글