일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- BFS
- 파이썬
- CodingTest
- Level2
- lv4
- 시간복잡도
- 프로그래머스
- python
- 조합
- 코테
- import re
- mysql
- join
- 연습문제
- coding test
- Queue
- Stack
- 코딩
- 코딩테스트
- coding
- programmers
- lambda
- time complexity
- collections
- 데이터분석
- sql
- counter
- itertools
- 완전탐색
- level4
- Today
- Total
목록구명보트 (1)
ror_coding
[Programmers] 구명보트 - 42885
최대 2명 태울 수 있으니 (작은값 + 큰값) 가능하면 넘기고 안 되면 큰 값 혼자 넘긴다.Question 구명보트를 최대한 적게 사용하여 모든 사람을 구출하려고 합니다.사람들의 몸무게를 담은 배열 people과 구명보트의 무게 제한 limit가 매개변수로 주어질 때, 모든 사람을 구출하기 위해 필요한 구명보트 개수의 최솟값을 return 하도록 solution 함수를 작성해주세요. Code def solution(people, limit): cnt = 0 people = sorted(people,reverse=True) for i in people: total = i if total + people[-1] now meOn my github
Algorithm/Python
2024. 10. 24. 12:02