Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
There is a car with a given capacity of empty seats available. The car only drives east. You are given the integer `capacity` and an array `trips` where `trips[i] = [numPassengersᵢ, fromᵢ, toᵢ]` indicates that the `i`-th trip has `numPassengersᵢ` passengers and the locations to pick them up and drop them off. The locations are given as the number of kilometers due east from the car's initial location. Return `true` if and only if it is possible to pick up and drop off all passengers for all the given trips.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.