DevYoon
[ํ๋ก๊ทธ๋๋จธ์ค] ํ๋ฆฐํฐ (Python) ๋ณธ๋ฌธ
link ๐ https://programmers.co.kr/learn/courses/30/lessons/42587
def solution(priorities, location):
answer = 0
while len(priorities) != 0:
flag = 1
for idx in range(1, len(priorities)):
if priorities[idx] > priorities[0]:
flag = 0
temp = priorities.pop(0)
priorities.append(temp)
if location == 0:
location = len(priorities)-1
else:
location -= 1
break
if flag:
if location == 0:
return answer+1
else:
priorities.pop(0)
answer += 1
location -= 1
return answer