A car with capacity seats picks up and drops off passengers at various stops. Return if all trips are possible.
Use a difference array: add passengers at start, remove at end. Scan stops checking capacity.
- Create stops array of size 1001
- For each trip add passengers at from, subtract at to
- Scan stops accumulating passengers
- If any point exceeds capacity return false
- Time Complexity: O(n)
- Space Complexity: O(1)