일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Promise
- map
- 공변성
- 투포인터
- Jest
- TS
- CORS
- autosize
- dfs
- app router
- useAppDispatch
- RTK Query
- webpack
- 타입 좁히기
- SSR
- 태그된 유니온
- 인터섹션
- CI/CD
- 리터럴 타입
- tailwind
- 반공변성
- 호이스팅
- 무한 스크롤
- 결정 알고리즘
- MSA
- ESlint
- React
- recoil
- async/await
- 인증/인가
Archives
- Today
- Total
짧은코딩
프로그래머스) 기능개발 본문
반응형
https://programmers.co.kr/learn/courses/30/lessons/42586
코딩테스트 연습 - 기능개발
프로그래머스 팀에서는 기능 개선 작업을 수행 중입니다. 각 기능은 진도가 100%일 때 서비스에 반영할 수 있습니다. 또, 각 기능의 개발속도는 모두 다르기 때문에 뒤에 있는 기능이 앞에 있는
programmers.co.kr
내 풀이(맞음)
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