seats passenger seats. You get a list of bookings rides: booking [people, a, b] means a group of people riders must be picked up at mark a and dropped off at mark b.
At any mark, riders getting off leave before new riders get on. Return True if the shuttle can serve every booking without ever exceeding its seats, and False otherwise.rides=[[3, 0, 4], [2, 2, 6], [1, 4, 8]], seats=5 → True
Between 2 and 4 there are 3 + 2 = 5 riders, exactly the number of seats. At 4 the first group leaves and the third gets on: 2 + 1 = 3. Everyone fits.
rides=[[3, 0, 4], [2, 2, 6], [1, 4, 8]], seats=4 → False
Between 2 and 4 there are 5 riders but only 4 seats.
rides=[[3, 0, 4], [2, 2, 6], [1, 4, 8]], seats=5
True
Run checks the first 3 tests in your browser. Submit checks all 113 tests on the server, hidden ones included.