Skip to content

Commit

Permalink
Merge pull request #134 from yuna83/28-yuna83
Browse files Browse the repository at this point in the history
28-yuna83
  • Loading branch information
yuna83 authored Feb 13, 2024
2 parents dfc478d + 4d9dacd commit eda9e3b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions yuna83/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
| 25차시 | 2024.01.25 | 스택/큐 | [주식 가격](https://school.programmers.co.kr/learn/courses/30/lessons/42584)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/121|
| 26차시 | 2024.01.30 | 딕셔너리 | [귤 고르기](https://school.programmers.co.kr/learn/courses/30/lessons/138476)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/125|
| 27차시 | 2024.02.05 | 투포인터 | [좋다](https://www.acmicpc.net/problem/1253)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/129|
| 28차시 | 2024.02.07 | 투포인터 | [구명보트](https://school.programmers.co.kr/learn/courses/30/lessons/42885)|https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/134|
---
15 changes: 15 additions & 0 deletions yuna83/투포인터/구명보트.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def solution(people, limit):
people.sort()
start = 0
end = len(people)-1
count = 0

while start <= end:
count += 1
if (people[start] + people[end] <= limit):
start += 1
end -= 1
else: # limit 초과 시 무거운 사람 한 명(end)만 태운다
end -= 1

return count

0 comments on commit eda9e3b

Please sign in to comment.