Find Min Distance to Furthest Node (Google Tokyo)
Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Google Tokyo pulled this one in February 2024 and it's a classic graph traversal setup dressed as a distance problem. You're handed a tree or graph and need to find the minimum distance to the furthest node from a given starting point. The trick is that "minimum distance to furthest" means you're optimizing for the worst-case node you have to reach, which flips how you normally think about shortest paths. StealthCoder will catch the pattern if you freeze mid-approach during the live OA.
Pattern and pitfall
This is a multi-source BFS or re-rooting problem masquerading as a simple traversal. Most candidates jump to Dijkstra or DFS and waste time. The real move is BFS from your starting node to find the furthest node, then BFS again from that node to map all distances. The insight: in a tree, the node furthest from any point is always one of the two ends of the diameter. You're computing eccentricity, which is the maximum distance from a node to any other node in the graph. The greedy two-pass BFS is linear and bulletproof. StealthCoder solves this instantly during the live assessment if you can't remember the diameter trick.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Find Min Distance to Furthest Node (Google Tokyo) 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 would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Google's OA.
Google reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Min Distance to Furthest Node (Google Tokyo) FAQ
Is this asking for the node itself or just the distance value?+
The problem title says 'min distance to furthest,' so you're returning the distance as an integer, not the node ID. But verify the exact return type when you see it live. Some versions ask for the node. Most ask for the distance. Check the examples.
What if there are multiple valid answers with the same distance?+
Return any one of them. Graph problems rarely care which specific node you pick if the distance is optimal. The OA will accept any correct distance value. If the problem specifies a tie-breaker (like smallest ID), that's usually in the examples.
Can I use DFS instead of BFS?+
Yes, DFS works fine for unweighted graphs and trees. BFS is slightly cleaner for distance tracking because it naturally layers by distance. Both are O(N). Pick whichever you code faster without mistakes.
Does this assume the graph is connected?+
Probably yes. Google OAs usually state this upfront. If the graph has disconnected components, clarify during the live OA whether you return infinity, -1, or handle each component separately. Don't assume; ask via the chat if you see the input structure.
How much time do I have to solve this?+
Typically 15-25 minutes for a single graph problem in a Google online assessment. If you know the diameter trick, coding it takes under 10 minutes. That leaves buffer for edge cases and testing. If you blank, StealthCoder runs silently and gives you the pattern.