Car Pooling (Sweep Line)

Medium · Intervals · about 15 minutes

Asked at Amazon, Uber, Google.

A car with capacity empty seats drives east only. trips[i] = [numPassengers, from, to]: that many passengers get on at kilometer from and off at to. Return true if every trip can be served without exceeding capacity.

Related guides