Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- react-redux
- Python
- axios
- createSlice
- redux-toolkit
- json-server
- java
- 테코테코
- maeil-mail
- redux
- C++
- 항해99
- 리액트
- 이코테
- useDispatch
- JavaScript
- react-router
- Algorithm
- react
- 자바
- 프로그래머스
- 항해플러스
- Get
- redux-saga
- 매일메일
- sw expert academy
- programmers
- 알고리즘
- SW
- 코딩테스트합격자되기
Archives
- Today
- Total
Binary Journey
[프로그래머스] 구명보트 본문
반응형
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges
** Python
def solution(people, limit):
answer = 0
people.sort()
start, end = 0, len(people) - 1
while start <= end:
answer += 1
if people[start] + people[end] <= limit:
start += 1
end -= 1
return answer
반응형
'프로그래머스 > level 2' 카테고리의 다른 글
[프로그래머스] 압축 (0) | 2021.12.28 |
---|---|
[프로그래머스] 가장 큰 정사각형 찾기 (0) | 2021.12.27 |
[프로그래머스] n 진수 게임 (0) | 2021.12.14 |
[프로그래머스] 다음 큰 숫자 (0) | 2021.12.07 |
[프로그래머스] 올바른 괄호 (0) | 2021.12.07 |