...

/

Solution: Boats to Save People

Solution: Boats to Save People

Let's solve the Boats to Save People problem using the Greedy pattern.

Statement

A big ship with numerous passengers is sinking, and there is a need to evacuate these people with the minimum number of life-saving boats. Each boat can carry, at most, two persons however, the weight of the people cannot exceed the carrying weight limit of the boat.

We are given an array, people, where people[i] is the weight of the ithi^{th} person, and an infinite number of boats, where each boat can carry a maximum weight, ...

Access this course and 1400+ top-rated courses and projects.