Back to problems

Schedule round trips

Algorithm · Meta · Medium

You need to shuttle back and forth between two towns, A and B. One round trip means travelling from A to B and then immediately coming back from B to A; altogether you must finish exactly missions such round trips, and you always set out from A. Two non-decreasing integer arrays describe the departure boards. The value aToB[i] is a moment at which a departure leaving A for B exists, while bToA[j] is a moment at which a departure leaving B for A exists. Your clock reads 0…

Checking your access…