Reported September 2026
Googlegreedy

Latest Arrival Time for a Shuttle

Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Google OA. Under 2s to a working solution.
Founder's read

Google reported this one in September 2026, and it looks like a simple shuttle problem until the edge cases show up. If you're taking the OA soon, the thing to know is that it's a sort plus two pointers simulation, with a hash set for collisions. Sort shuttles and passengers, board everyone greedily, then work backward from the last shuttle to find your slot. It's the same shape as the LeetCode problem of the same name. The logic is short but the off-by-one traps are real. StealthCoder is the safety net if you blank mid-assessment.

The problem

You are given integer shuttle departure times shuttles, integer arrival times passengers for the other passengers, and the capacity of every shuttle.
A passenger may board a shuttle when the passenger arrives no later than that shuttle departs. Process the other passengers from earliest arrival to latest arrival. Each passenger boards the earliest shuttle that still has an available seat.
Choose an integer arrival time for yourself. Your arrival time must be different from every value in passengers. Return the latest arrival time that still lets you board some shuttle.
The input arrays may be unsorted. If the final shuttle has an empty seat after the other passengers board, its departure time is the latest initial candidate. If it is full, the latest initial candidate is one unit before the last passenger who boarded it. In either case, move the candidate earlier while another passenger already uses that time.

Function
latestShuttleArrival(shuttles: int[], passengers: int[], capacity: int) → int

Examples
Example 1
shuttles = [10,20]
passengers = [2,17,18,19]
capacity = 2
return = 16
The shuttle at 20 fills with passengers arriving at 17 and 18. You must arrive before 18, and 17 is already occupied, so the latest available time is 16.
Example 2
shuttles = [20,30]
passengers = [19,20,21,29]
capacity = 2
return = 28
The shuttle at 30 boards the passengers at 21 and 29. It is full, so you must arrive before 29; 28 is unused.
Example 3
shuttles = [10]
passengers = [2,3]
capacity = 3
return = 10
One seat remains on the shuttle, and no passenger arrives at its departure time, so you may arrive at 10.

Constraints
1 <= shuttles.length, passengers.length <= 10^5.
1 <= capacity <= 10^5.
1 <= shuttles[i], passengers[i] <= 10^9.
Departure times are unique within shuttles, and arrival times are unique within passengers.
At least one valid arrival time exists.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The solution hinges on a hash set of passenger arrival times, plus sorted arrays. Sort both inputs. Walk each shuttle with a pointer into passengers, boarding up to capacity people who arrived no later than departure. After the last shuttle, check whether it has an empty seat. If yes, your candidate is that shuttle's departure time. If it's full, your candidate is one before the last boarded passenger. Then decrement the candidate while it's in the set. The common pitfall is forgetting that you can't share a time with any passenger, not just boarded ones. Another is starting from the wrong passenger index when the last shuttle is full. Track the last boarded passenger explicitly. If the logic slips under pressure, StealthCoder can run invisibly during the live OA and give you a working solution as a hedge.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Latest Arrival Time for a Shuttle cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as the latest time to catch a bus. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Google's OA.

Google reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Latest Arrival Time for a Shuttle FAQ

What's the trick in the Google shuttle arrival problem?+

Sort both arrays, simulate boarding greedily with two pointers, then pick a candidate time from the last shuttle. Put all passenger times in a set and step the candidate down until it's free. That's the whole solution.

How hard is this problem really?+

Medium. The idea is simple, but the edge cases decide it: a full versus non-full last shuttle, and collisions with passenger times. Most failed attempts come from candidate selection, not the simulation loop.

What's the time complexity?+

O(n log n + m log m) for sorting shuttles and passengers, then O(n + m) for the boarding pass. The collision check is amortized, since the candidate only moves backward and each step hits a set lookup.

Why do I need a set instead of just checking the sorted array?+

You can step the candidate down through a run of consecutive occupied times. A set gives O(1) lookups for each step. Checking the sorted array works too if you walk backward with a pointer, but a set is harder to get wrong.

How do I prepare for this in 48 hours?+

Write the solution from scratch twice. Test the three given examples plus a case with a full last shuttle and a run of consecutive passenger times. Focus on sort, two pointers, and the candidate decrement loop rather than learning new patterns.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Google.

OA at Google?
Invisible during screen share
Get it