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

PROGRAMMERS 42586: 기능개발

by cjw.git 2021. 1. 5.

Link : programmers.co.kr/learn/courses/30/lessons/42586


Python

더보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def solution(progresses, speeds):
    answer = []
 
    while len(progresses):
        for i in range(len(progresses)):
            progresses[i] += speeds[i]
 
        stack = []
        for i in range(len(progresses)):
            if progresses[i] >= 100:
                stack.append(i)
            else:
                break
 
        if len(stack) != 0:
            stack.reverse()
            for i in stack:
                progresses.pop(i)
                speeds.pop(i)
            answer.append(len(stack))
 
    return answer
cs

FeedBack

  1.  

 

 

 

cjw.git@gmail.com

'알고리즘 > 소스코드' 카테고리의 다른 글

PROGRAMMERS 42885: 구명보트  (0) 2021.01.05
PROGRAMMERS 42583: 다리를 지나는 트럭  (0) 2021.01.05
PROGRAMMERS 42584: 주식가격  (0) 2021.01.05
PROGRAMMERS 42579: 베스트앨범  (0) 2021.01.05
PROGRAMMERS 42578: 위장  (0) 2021.01.05

댓글