반응형
문제 유형은 스택 큐라고 돼있는데
나는 그냥 내 생각대로 풀었따 ㅎ...
계속 답이 안나와서 좀 답답함이 있었지만
그래도 검색 안하고 직접 풀어서 해결했다!!
def solution(progresses, speeds):
answer = []
subtotal = 0
for i in range(len(progresses)):
if progresses[i] < 100:
if subtotal > 0:
answer.append(subtotal)
subtotal = 0
while progresses[i] < 100:
for j in range(i, len(progresses)):
progresses[j] += speeds[j]
subtotal+=1
else:
subtotal+=1
if i == len(progresses)-1:
answer.append(subtotal)
return answer
꾸준히 화이팅!
반응형
'개발💻 > 알고리즘' 카테고리의 다른 글
[프로그래머스] 네트워크 Python (21) | 2024.03.19 |
---|---|
[프로그래머스] 카펫 Python (22) | 2024.03.18 |
[프로그래머스] 피보나치 수 Python (2) | 2024.03.11 |
[프로그래머스] 타겟 넘버 Python (0) | 2024.03.11 |
[프로그래머스] 모의고사 Python (25) | 2024.03.09 |