I went with binary search first because two pointers felt fiddly to get right under pressure.
Model the problem as a simulation where for each mission, you find the earliest departure from the current location that is at or after the current time, then add the travel time. Use binary search (or two pointers) on the sorted departure arrays to efficiently find the next departure, and repeat for m round trips.
Pro tip: Clarify whether the arrays are 0-indexed and if there are multiple identical departure times; also confirm if the traveler can wait at a location for any amount of time. This shows attention to edge cases and prevents off-by-one errors.
Confirm that each leg takes exactly 100 time units, that the traveler always takes the next available departure at or after arrival, and that m can be zero. Ask about duplicate departure times and whether the arrays are sorted ascending.
Initialize current time to 0 and current location to A. For each of the m missions, simulate the outbound leg (A to B) and return leg (B to A) by finding the next departure and adding 100.
Use binary search (lower_bound) on the sorted departure array to find the first departure time >= current time. If none exists, the mission cannot be completed (handle as needed).
After finding the departure, set current time to departure + 100 (arrival time) and switch location. Repeat for each leg.
After completing all m round trips, the current time is the earliest time the last mission completes back at A. Return that value.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.