본문 바로가기
알고리즘/소스코드

PROGRAMMERS 42587: 프린터

by cjw.git 2021. 1. 9.

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

  1.  

 

 

 

cjw.git@gmail.com

댓글