Hot Air Balloon Booking

ARRAY
GREEDY
SORTING

Problem

Given a list of flight intervals flights where flights[i] = [start_i, end_i] represents the start and end times of a flight, determine the minimum number of hot air balloons required to schedule all the flights so that no two flights on the same balloon overlap in time.

Examples

minHotAirBalloons([[5,9],[1,3]]) // returns 1 // Balloon 1: Flight from 1 to 3 and flight from 5 to 9 minHotAirBalloons([[5,9],[1,3],[2,6]]) // returns 2 /* Balloon 1: Flight from 1 to 3 Balloon 2: Flight from 2 to 6 (since balloon1 is occupied) Balloon 1: Flight from 5 to 9 (since the 1st flight in balloon1 is over) */
Loading...
5
9
1
3