LeetCode: 1094-Car Pooling 解題紀錄
Last Updated on 2022-01-06 by Clay
題目
There is a car withRead More »LeetCode: 1094-Car Pooling 解題紀錄capacity
empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integercapacity
and an arraytrips
wheretrip[i] = [numPassengersi, fromi, toi]
indicates that theith
trip hasnumPassengersi
passengers and the locations to pick them up and drop them off arefromi
andtoi
respectively. The locations are given as the number of kilometers due east from the car's initial location. Returntrue
if it is possible to pick up and drop off all passengers for all the given trips, orfalse
otherwise.