We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e66984c commit ccd7889Copy full SHA for ccd7889
1 file changed
live8/test87/문제2/박희경.py
@@ -3,12 +3,10 @@ def solution(people, limit):
3
people.sort()
4
5
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
+ while start <= end:
+ if people[start] + people[end] <= limit:
+ start += 1
+ end -= 1
+ answer += 1
13
14
- return answer
+ return answer
0 commit comments