Notice
Recent Posts
Recent Comments
Link
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Archives
Today
Total
관리 메뉴

NISSO

[프로그래머스 Lv2][스택/큐] 기능개발 본문

Coding Test

[프로그래머스 Lv2][스택/큐] 기능개발

oniss 2021. 7. 2. 16:09
import math
def solution(progresses, speeds):
    queue,answer = [math.ceil((100-progresses[0])/speeds[0])],[]
    for p,s in zip(progresses[1:]+[0], speeds[1:]+[1]):
        crnt = math.ceil((100-p)/s)
        if crnt > queue[0]:
            answer.append(len(queue))
            queue = []
        queue.append(crnt)
    return answer

레벨 2는 처음 푸는데 스택/큐 문제도 거의 안 풀어봤고, 알 것 같은데 안 풀려서 문제랑 거의 싸우다싶이 풀었다.

코테가 약 2시간 남았으니 코드 설명은 나중에 쓰기로... (지금 안 쓰면 나중에도 안 쓸 것 같아서 게시글은 올려둔다)

Comments