Reported February 2026
Uberunion find

Minimum Euclidean Plate Collection Time

Reported by candidates from Uber's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Uber OA. Under 2s to a working solution.
Founder's read

The Uber OA reported in February 2026 looks like a geometry problem, but it's really counting connected components. Plates within Euclidean distance d of each other chain together, and one pick clears a whole chain. So the answer is the number of components. If you've got an assessment coming up, this one is short once you spot it. If you blank in the live OA, StealthCoder runs invisibly as a safety net and reads the problem for you. The trap is in the distance check, and it breaks a lot of first attempts.

The problem

You are given n plates placed on a 2D grid. Plate i is located at coordinate (x[i], y[i]). Each plate has the same magnetic attraction power d.
Two plates are directly connected if the Euclidean distance between them is less than or equal to d. Connectivity is transitive: if a plate is connected directly or indirectly to another plate, collecting one plate collects the entire connected component in the same second.
You may choose one uncollected plate per second. Return the minimum number of seconds required to collect all plates.

Function
getMinEuclideanTime(n: int, d: int, x: int[], y: int[]) → int

Examples
Example 1
n = 4
d = 1
x = [0, 0, 1, 2]
y = [0, 1, 0, 2]
return = 2
The first three plates form one connected component because adjacent distances are at most 1. The plate at (2,2) is separate, so two seconds are needed.
Example 2
n = 3
d = 2
x = [0, 3, 6]
y = [0, 0, 0]
return = 3
Each pair of neighboring plates is distance 3 apart, which is greater than d, so each plate is collected separately.

Constraints
Constraints:
1 <= n <= 1000
0 <= d <= 10000
0 <= x[i], y[i] <= 10000
x.length == y.length == n

Reported by candidates. Source: FastPrep

Pattern and pitfall

Build a union-find over the n plates. For every pair (i, j), compare dx*dx + dy*dy against d*d using integers. Never take a square root, since floats can misjudge a distance that equals d exactly. If it's within d, union the two. Count the distinct roots at the end. That's O(n^2) pairs, about 500k with n = 1000, which is fine. The edge cases that break naive solutions: d = 0 only connects plates at identical coordinates, so duplicates collapse into one component. Another pitfall is only linking adjacent plates in input order, which misses indirect chains. Example 2 shows the opposite failure: distance 3 with d = 2 means no links, so the answer is 3. A BFS or DFS over an implicit graph works equally well. If the live OA freezes you on the setup, StealthCoder is the hedge that hands you the structure while you type.

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 Minimum Euclidean Plate Collection 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. 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 Uber's OA.

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

Minimum Euclidean Plate Collection Time FAQ

What's the trick in Minimum Euclidean Plate Collection Time?+

Collecting one plate collects its entire connected group, so the answer is just the number of connected components. Link any two plates whose distance is at most d, then count the groups. Union-find or DFS both work cleanly here.

Should I use square root for the distance?+

No. Compare dx*dx + dy*dy to d*d with integers. Max values are about 2*10^8, which fits in a 32-bit int but check your language. This avoids floating point errors on distances exactly equal to d.

What happens when d is 0?+

Only plates at the exact same coordinates connect. Duplicate points merge into one component, and every distinct location costs one second. The integer comparison dist2 <= 0 handles this without a special case.

Is O(n^2) fast enough with n up to 1000?+

Yes. That's roughly 500,000 pair checks, trivial for any language. You don't need a spatial grid or k-d tree. Save your effort for getting the union-find and the edge cases right.

How do I prepare for this in 48 hours?+

Write union-find from memory once, with path compression. Then solve two or three connected-component counting problems on implicit graphs. This Uber question from February 2026 is that pattern with a distance check bolted on.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Uber.

OA at Uber?
Invisible during screen share
Get it