일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- app router
- ESlint
- CI/CD
- TS
- webpack
- autosize
- recoil
- useAppDispatch
- CORS
- SSR
- 결정 알고리즘
- 태그된 유니온
- map
- Promise
- 투포인터
- 반공변성
- RTK Query
- 공변성
- 이분 검색
- Jest
- 리터럴 타입
- React
- 타입 좁히기
- Cypress
- 인터섹션
- 호이스팅
- async/await
- dfs
- tailwind
- 무한 스크롤
Archives
- Today
- Total
짧은코딩
프로그래머스) 기능개발 본문
반응형
https://programmers.co.kr/learn/courses/30/lessons/42586
내 풀이(맞음)
def solution(progresses, speeds):
answer = []
while progresses:
count = 0
for i in range(len(progresses)):
if progresses[i] >= 100:
continue
progresses[i] += speeds[i]
while progresses:
if progresses[0] >= 100:
count += 1
del progresses[0]
del speeds[0]
if not progresses and count:
answer.append(count)
else:
if count > 0:
answer.append(count)
break
return answer
progresses에 speeds를 각각 더해준다. 그러다가 맨처음에 100이 넘는게 생기면 몇개가 연속적으로 생기는지 체크하고 그 수를 answer에 삽입한다.
반응형
'코딩 테스트(Python) > 백준, 프로그래머스' 카테고리의 다른 글
10815 숫자 카드 (1) | 2022.06.02 |
---|---|
프로그래머스) 더 맵게 (0) | 2022.05.01 |
1766 문제집 (0) | 2022.04.15 |
7662 이중 우선순위 큐 (0) | 2022.04.08 |
프로그래머스) 완주하지 못한 선수 (0) | 2022.04.06 |
Comments