Skip to content

Conversation

@heeheejj
Copy link
Contributor

PRG 42885 구명보트=

  • 프로그래머스 코딩테스트 고득점 kit > Greedy
  • 1270 (+11)

🚩 설계

  • 투포인터 이용
  • 몸무게를 오름차순 정렬한 뒤,
    1. 두 명(몸무게가 가장 적은 사람, 몸무게가 가장 많은 사람)을 태우거나
    2. 한 명(몸무게가 가장 많은 사람)을 태운다.
      l == r 인 경우는 남은 사람이 한명인 경우이므로, 무조건 answer+=1 -> while l <= r로 처리

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant