Reported December 2024
Googlebreadth first search

Reach the End In Time

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 asked this in December 2024, and it's a graph traversal problem dressed up as a race-against-the-clock scenario. You're given a start, an end, and some kind of constraint (time, moves, edges) that forces you to find the fastest path. The trap: candidates overthink the constraint and miss that this is just BFS or Dijkstra. StealthCoder catches that moment when you blank on which traversal to use and feeds you the pattern in real time.

Pattern and pitfall

The core trick is recognizing that 'reach in time' maps to a shortest-path problem on a graph. If all edge costs are equal (each move costs 1), BFS is your answer. If edges have different costs (time to traverse each road is different), Dijkstra's algorithm solves it. The common pitfall: candidates try to DFS and backtrack, wasting time. Another trap: they confuse the end condition (did I reach the goal within the time limit?) with the search itself (find the path that gets there fastest). The graph might be implicit (grid, adjacency list, or dynamic neighbor generation), so you also need to handle node exploration correctly. StealthCoder acts as your safety net on the OA if you freeze on whether to BFS, DFS, or Dijkstra.

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 Reach the End In Time 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

⏵ 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.

Reach the End In Time FAQ

Is this a shortest-path problem or a constraint-satisfaction problem?+

Both. You're finding the shortest path (BFS or Dijkstra) and then checking if it satisfies the time/move constraint. If the problem says 'reach in X seconds', think shortest-path first, then validate the result against X.

When do I use BFS vs Dijkstra?+

BFS if all moves cost the same (uniform edge weights). Dijkstra if moving between nodes has different costs (e.g., roads with different travel times). Google often mixes this on purpose. Read the edge costs carefully.

What if the graph is implicit, not given as an adjacency list?+

Build neighbors on the fly. If it's a grid, neighbors are up/down/left/right. If it's a state-space (positions, time remaining), generate neighbors based on valid moves. This is common in Google OAs.

How do I know if I found the right answer?+

Trace through a small example by hand. Start at the source, apply BFS or Dijkstra, and check if the path length or cost meets the time limit. If yes, output the path or true. If no, output false or -1.

Can I solve this in 20 minutes?+

Yes, if you recognize the pattern immediately. BFS is 10 lines. Dijkstra is 20. The hard part is parsing the problem text, not the code. Spend 5 minutes understanding what 'reach in time' means in the context given.

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