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 |
29 | 30 |
Tags
- json-server
- 코딩테스트합격자되기
- 항해99
- Algorithm
- sw expert academy
- react
- Python
- Get
- createSlice
- 프로그래머스
- react-router
- programmers
- 자바
- useDispatch
- SW
- java
- 이코테
- axios
- 매일메일
- 알고리즘
- maeil-mail
- redux-saga
- 항해플러스
- react-redux
- redux-toolkit
- redux
- 테코테코
- JavaScript
- C++
- 리액트
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 |