Reported September 2026
Googlegraph

Reach a Meeting by Scheduled Trains

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 the detail that matters is the exact-time transfer. A ride arriving at time 5 lets you board a ride leaving at 5. The problem hands you a timetable of directed train rides, a start city, a start time and a meeting deadline. It looks like a graph problem, and it is, but it's a time-ordered one. With up to 200,000 rides, a brute-force search dies fast. If you blank mid-assessment, StealthCoder runs invisibly on your desktop and gives you the approach in real time. Here's the script before you need it.

The problem

A timetable contains directed train rides. Ride i leaves city origins[i] at time departures[i], reaches city destinations[i] at time arrivals[i], and may be used at most once.
You begin in start at startTime. You may wait in any city for any nonnegative amount of time. You may board a ride when you are in its origin city at or before its departure time.
Return true if you can reach destination no later than meetingTime. Otherwise, return false.
A transfer is allowed when one ride arrives at the exact time that the next ride departs. If start already equals destination, reaching the meeting depends only on whether startTime is no later than meetingTime.

Function
canReachMeeting(origins: String[], departures: int[], destinations: String[], arrivals: int[], start: String, startTime: int, destination: String, meetingTime: int) → boolean

Examples
Example 1
origins = ["A","B","A"]
departures = [1,5,3]
destinations = ["B","C","C"]
arrivals = [4,7,10]
start = "A"
startTime = 0
destination = "C"
meetingTime = 8
return = true
Take the ride from A to B, arriving at 4, then take the ride from B to C, arriving at 7.
Example 2
origins = ["A","B","A"]
departures = [1,5,3]
destinations = ["B","C","C"]
arrivals = [4,7,10]
start = "A"
startTime = 0
destination = "C"
meetingTime = 6
return = false
The earliest possible arrival in C is time 7, which is after the meeting time.
Example 3
origins = ["A","B"]
departures = [2,5]
destinations = ["B","C"]
arrivals = [5,6]
start = "A"
startTime = 2
destination = "C"
meetingTime = 6
return = true
You board the first ride exactly at startTime. It arrives in B at time 5, allowing an exact-time transfer to the second ride.

Constraints
1 <= origins.length <= 2 * 10^5.
origins.length == departures.length == destinations.length == arrivals.length.
Every city name is nonempty and contains at most 30 letters or digits.
0 <= departures[i] <= arrivals[i] <= 10^9.
0 <= startTime, meetingTime <= 10^9.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is to process rides in order of departure time and track the earliest arrival time per city. Sort rides by departure. Keep a map from city to earliest known arrival, seeded with start at startTime. For each ride, if its origin has an earliest time at or before the departure, you can board it, so update the destination's earliest time with the arrival. Because arrivals are never before departures, one sorted pass is enough. Final check: earliest[destination] <= meetingTime. The pitfalls are real. Handle start equal to destination first, where only startTime <= meetingTime matters. Use <= for boarding so exact transfers work. Don't build a full graph and run Dijkstra when a sort and a hash map do it. Zero-duration rides (departure equals arrival) can chain at the same timestamp, so tie-break order matters. If the live OA freezes you on that, StealthCoder is the hedge that keeps you moving. Complexity is O(n log n).

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Reach a Meeting by Scheduled Trains 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. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Google reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Reach a Meeting by Scheduled Trains FAQ

What's the trick for the Google train meeting problem?+

Sort rides by departure time and keep the earliest arrival time per city in a hash map. Board a ride if its origin's earliest time is at or before the departure. Update the destination with the arrival. One pass, then compare against meetingTime.

Do I need Dijkstra or BFS here?+

No. Dijkstra works but it's overkill. Since time only moves forward and rides are single-use, processing rides in departure order gives the same answer with a simple sort and map. It's O(n log n), which fits 2 * 10^5 rides comfortably.

How do I handle zero-duration rides and exact transfers?+

Use <= when checking if you can board, so arriving at time 5 allows departing at 5. For zero-duration rides where departure equals arrival, sort ties carefully. Sorting by departure then arrival is a reasonable tiebreak, but test a chain of same-time rides to confirm it behaves.

What edge cases break most solutions?+

Start equal to destination is the big one. Then the answer is just startTime <= meetingTime, no rides needed. Also watch for startTime already past a ride's departure, cities with no rides, and destinations that are never reached. Return false for those.

How should I prepare for this in 48 hours?+

Write the sorted-rides plus earliest-arrival map solution from scratch twice. Then test the three given examples plus start equals destination and a same-time transfer chain. Know why sorting by departure is safe. That covers the whole problem.

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