기술 블로그
[프로그래머스] 프로세스 본문
반응형
from collections import deque
def solution(priorities, location):
#배열을 만들어야함
arr=[ i for i in range(len(priorities))]
print(arr)
at = priorities[location]
answer = 0
q = deque(arr)
while True:
n = q.popleft() # 인덱스
dn = priorities[n] #실값
if dn<max(priorities): # 돌아가
q.append(n)
else:# 뺄차례
priorities[n] = 0
answer += 1
if location == n:
break
return answer
반응형
Comments