Skip to content

Commit ccd7889

Browse files
committed
87차 2번 문제 다시 풀이
1 parent e66984c commit ccd7889

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

live8/test87/문제2/박희경.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ def solution(people, limit):
33
people.sort()
44

55
start, end = 0, len(people) - 1
6-
while start < end:
7-
mid = (start + end) // 2
8-
total = people[start] + people[mid]
9-
if total > limit:
10-
mid = end - 1
11-
else:
12-
mid = start + 1
6+
while start <= end:
7+
if people[start] + people[end] <= limit:
8+
start += 1
9+
end -= 1
10+
answer += 1
1311

14-
return answer
12+
return answer

0 commit comments

Comments
 (0)