일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Stack
- 완전탐색
- coding
- itertools
- CodingTest
- level4
- import re
- 코테
- 시간복잡도
- join
- 프로그래머스
- time complexity
- mysql
- 코딩테스트
- programmers
- Level2
- Queue
- BFS
- sql
- lambda
- 코딩
- 데이터분석
- coding test
- counter
- 조합
- lv4
- collections
- 파이썬
- 연습문제
- python
- Today
- Total
목록42885 (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