AO
Back

Group Points Closer Than a Distance Threshold

Also reported as 3D Point Clustering

Phone ScreenPhone ScreenLast reported September 2026Low Frequency

Problem Overview

The round: three reports, from Nuro phone screens in January, August and September 2026, one of them for an AI Platform new-grad role. You are given point coordinates. Points closer than a distance k belong to the same group, and grouping carries through chains: if A is close to B and B is close to C, all three are one group. One report has 3D points and asks you to return every cluster. Two reports give the same follow-up: there are very many points and they are sparse, so how do you cut the computation? One candidate used union-find. One reply complains that 45 minutes leaves no time to optimize or debug. Two graded parts.

Part 1 — group points closer than k

def cluster_points(points: list[tuple], k: float) -> list[list[int]]: ...
  • points[i] is a tuple of coordinates. All points have the same number of coordinates: 2 or 3. One report has 3D points; the other two only say coordinates, so 2D is our reading.
  • Points i and j are close when their Euclidean distance is less than k. Groups are the chains of close points.
  • Return the groups as lists of point indexes. Each group is sorted ascending, and the groups are ordered by their smallest index. A point with no close neighbour is a group of its own.
  • k must be a positive number. Points with different numbers of coordinates raise ValueError, and so does k <= 0. No points gives [].
points = [(0, 0), (1, 0), (5, 5), (2, 0), (9, 9)],  k = 1.5
-> [[0, 1, 3], [2], [4]]      (0-1 and 1-3 are close; 0-3 is 2 apart but chained)

Part 2 — many sparse points

def cluster_points_fast(points: list[tuple], k: float) -> list[list[int]]: ...
  • Same input, rules and output as Part 1.
  • Do not compare every pair. The tests use 20,000 points, where checking all pairs is about 200 million distance checks.

Notes: the transitive grouping under a distance, the 3D version and the sparse follow-up are reported. The strict "less than" is the reported wording. No report names the distance; Euclidean is our choice. The signatures, returning indexes, the output order and the ValueError rules are ours. No report gives an answer to the follow-up: bucketing points into a grid is our approach, and a k-d tree is another.

Speed is not graded here: the editor cannot time your code, so the tests check only the groups. Part 2's point is the reported ask to beat comparing every pair; say what your version costs.

Follow-up Arc

Interviewers escalate through these phases. The order varies, but most candidates see at least one from each bucket.
Trade-off discussion · 1
Trade-off discussion

If there are very many points and they are sparse, how do you reduce the computation?

Probes for: after the basic grouping works; reported in two screens

What Reports Emphasize

What the reports say: points closer than k join a group, and grouping chains. One report asks it in 3D. Two reports follow up on many sparse points: how do you cut the computation? One candidate used union-find. Rounds are 45 minutes, so leave time for the follow-up.

Common mistakes (ours, not reported): Grouping only direct neighbours; using <= for a strict threshold; a grid that checks only its own cell; int() instead of floor for negative coordinates.

Edge cases to test (ours): Points exactly k apart; a long chain; duplicate points; close points on either side of a cell edge.

Practice

Write your own against 10 test cases, or read the worked solution — approach, complexity, and code that runs.
Did this match your interview?

If you have had this round, tell us how close this page was. It is how we keep the pages accurate.

Prepping for Nuro with friends?

Send them this page. It is free to read, no account needed.

More Nuro Questions

Free preview

Every question in the Nuro catalog gets this depth

What you just read — canonical solution, follow-up arc, what passing candidates actually did — exists for all 27 Nuro questions, refreshed monthly from new candidate reports.

$59/mo — or $50/mo with the 3-month pass · cancel anytime
Nuro · Phone Screen · Reported 3× across candidate reports
Is this helpful?