[Level 2] 구명보트

나며기·2021년 11월 16일
0

programmers

목록 보기
111/111
post-thumbnail
def solution(people, limit):
    answer = 0
    people.sort()
    i, j = 0, len(people) - 1
    while i <= j:
        answer += 1
        if people[i] + people[j] <= limit:
            i += 1
        j -= 1
    return answer
profile
PLUS ULTRA

0개의 댓글