Link : programmers.co.kr/learn/courses/30/lessons/42587
Python
더보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
def solution(priorities, location):
stack = []
for idx, val in enumerate(priorities):
priorities[idx] = [idx, val]
while len(priorities):
value = priorities.pop(0)
for i in priorities:
if value[1] < i[1]:
priorities.append(value)
break
else:
stack.append(value)
for idx, val in enumerate(stack):
if val[0] == location:
return idx + 1
|
cs |
FeedBack
cjw.git@gmail.com
'알고리즘 > 소스코드' 카테고리의 다른 글
PROGRAMMERS 60057: 문자열 압축 (0) | 2021.01.11 |
---|---|
PROGRAMMERS 12899: 124 나라의 숫자 (0) | 2021.01.11 |
PROGRAMMERS 12953: N개의 최소공배수 (0) | 2021.01.06 |
PROGRAMMERS 68645: 삼각 달팽이 (0) | 2021.01.06 |
PROGRAMMERS 49993: 스킬트리 (0) | 2021.01.06 |
댓글