You are given a buses of length n, where buses[i] represents the departure time of the passengers of length m, where passengers[j] represents the arrival time of the capacity, which denotes the maximum number of passengers that can board any single bus.
Passengers board buses in order of their arrival time. Each passenger will board the earliest departing bus that still has available capacity and departs at or after their arrival time.
You want to catch a bus. You are allowed to board a bus if there is remaining capacity at its departure time, but you cannot arrive at the same time as any other passenger.
Return the latest time you can arrive to catch a bus.
Note: You cannot arrive at the same time as another passenger, and you must arrive at or before the departure time of the bus you board.
Constraints:
n buses.length
m passengers.length
n, m, capacity
buses[i], passengers[i]
Each element in buses is unique.
Each element in passengers is unique.
You are given a buses of length n, where buses[i] represents the departure time of the passengers of length m, where passengers[j] represents the arrival time of the capacity, which denotes the maximum number of passengers that can board any single bus.
Passengers board buses in order of their arrival time. Each passenger will board the earliest departing bus that still has available capacity and departs at or after their arrival time.
You want to catch a bus. You are allowed to board a bus if there is remaining capacity at its departure time, but you cannot arrive at the same time as any other passenger.
Return the latest time you can arrive to catch a bus.
Note: You cannot arrive at the same time as another passenger, and you must arrive at or before the departure time of the bus you board.
Constraints:
n buses.length
m passengers.length
n, m, capacity
buses[i], passengers[i]
Each element in buses is unique.
Each element in passengers is unique.