STUDY/Algorithm

[프로그래머스] LEVEL2 기능개발, python3, 스택/큐

sinawi95 2019. 10. 22. 17:10
728x90

def solution(progresses, speeds):
    answer = []
    while (progresses!=[]):
        ed=[]                   # complete
        len_p=len(progresses)
        for i in range(len_p):
            progresses[i]+=speeds[i]
        for i in range(len_p):
            if progresses[i]>=100:
                ed.append(progresses[i])
            else:
                break
        if ed!=[]:
            answer.append(len(ed))
        for i in ed:
            del progresses[0]
            del speeds[0]
    return answer