Max Distance
Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Google's Max Distance question landed in February 2024 OAs, and candidates report it without a clear problem statement. You're looking at a geometry or distance-calculation problem, likely asking for the maximum separation between two points or entities under constraints. The trick is almost always that brute force works if the input size is small, or a mathematical insight (sorting, coordinate transformation, or spatial indexing) cuts through the noise. StealthCoder can help you pattern-match at runtime if you blank on the setup.
Pattern and pitfall
Without the full problem text, expect either a 2D/3D distance problem where you find the farthest pair of points, or a constraint-satisfaction problem where you maximize some separation metric. Common pitfalls: misreading whether distance is Euclidean or Manhattan, forgetting to check all pairs, or overcomplicating when a simple sort works. The pattern is likely sorting or two-pointers if pairs are involved, or it could be a coordinate-compression + greedy approach. If you're stuck mid-OA and can't recall the exact algorithm, StealthCoder reads the problem on screen and surfaces the pattern so you can code confidently.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Max Distance 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 StealthCoderRelated leaked OAs
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.
Max Distance FAQ
Is this a Euclidean or Manhattan distance problem?+
Google usually specifies in the problem statement. If it doesn't say, assume Euclidean (square root of sum of squared differences). That said, the pattern works the same way: sort points and compare all relevant pairs or use a spatial technique. Clarify from the problem text first.
Do I need to check every pair of points?+
Depends on constraints. If n is under 1000, brute force O(n^2) is safe. If n is larger, you likely need sorting or a divide-and-conquer approach to avoid timeout. Read the constraints carefully in your OA.
What if the problem asks for max distance between specific object types?+
Filter the points first, then apply the distance logic. Google sometimes adds a twist like 'max distance between a red point and a blue point.' The core algorithm stays the same, just adjust the comparison loop.
Should I use a library function for distance calculation?+
Yes. Python has math.dist, Java has Point2D.distance. It's faster and cleaner than hand-rolling. Just make sure you understand what distance metric it uses before submitting.
How do I prep for this in 24 hours if I've never seen it?+
Review the LeetCode-equivalent problem (likely 'max points on a line' or 'farthest two points in a plane'), understand sorting and pair comparison, then code a working brute force. If you blank during the OA, you have StealthCoder to unblock.