Radar Barrier Crossing
Reported by candidates from Snap's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Snap reported this one in October 2026, and it looks like geometry but it's really a connectivity check. Circles are nodes, touching circles are edges, and you're asking whether any cluster bridges the bottom wall to the top wall. If one does, the object is blocked and you return false. If you've got an OA invite and 48 hours, this is a union-find or DFS problem wearing a radar costume. StealthCoder sits as a quiet safety net during the live OA if the geometry makes you blank, but the logic below is short enough to carry in your head.
The problem
A rectangular area spans 0 <= x <= width and 0 <= y <= height. Each row [x, y, radius] in radars describes a closed circular detection region centered inside the rectangle. An object wants to travel continuously from the left wall to the right wall without entering or touching any detection region. Two radar regions belong to the same component when their circles overlap or touch, directly or through other radars. A left-to-right undetected crossing is impossible exactly when one connected radar component touches both the bottom wall and the top wall. Return true when an undetected crossing is possible; otherwise return false. Function canCrossUndetected(width: int, height: int, radars: int[][]) → boolean Examples Example 1 width = 10 height = 10 radars = [[5,2,3],[5,8,3]] return = false The two circles touch. The lower one reaches the bottom wall and the upper one reaches the top wall, so their component forms a complete barrier. Example 2 width = 12 height = 10 radars = [[2,2,2],[6,2,2],[10,2,2]] return = true The horizontal component touches the bottom wall but not the top wall, so it does not separate the left and right walls. Example 3 width = 8 height = 6 radars = [] return = true With no detection regions, an undetected left-to-right route exists. Constraints 1 <= width, height <= 10^9. 0 <= radars.length <= 1000. Every radar row contains exactly [x, y, radius]. 0 <= x <= width and 0 <= y <= height. 0 <= radius <= 10^9. Circle overlap, tangency, and wall contact are inclusive. Use 64-bit arithmetic for squared-distance comparisons.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Build a graph over the radars. Two radars connect when (x1-x2)^2 + (y1-y2)^2 <= (r1+r2)^2. Use 64-bit math and compare squared values, never take square roots. Mark a radar as touching the bottom if y - r <= 0 and touching the top if y + r >= height. Then run union-find or DFS, and for each component track whether it has both flags. Any component with both means return false, otherwise true. The pitfalls are inclusive comparisons (tangent counts as touching), integer overflow with radii up to 10^9, and accidentally checking left and right walls instead of top and bottom. Pairwise checks cost O(n^2) with n up to 1000, which is fine. If you freeze mid-OA, StealthCoder can hand you the union-find skeleton so you just verify the inequalities.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Radar Barrier Crossing 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 Snap's OA.
Snap 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.
Radar Barrier Crossing FAQ
What's the trick in the Snap Radar Barrier Crossing problem?+
Flip the question. Instead of finding a path, look for a wall of circles. Connect overlapping or touching circles, then check whether any connected group touches both the top and bottom walls. If it does, the crossing is blocked and you return false.
How hard is this problem really?+
Medium. The code is short, but you have to see the graph reduction. Once you do, it's standard union-find or DFS plus a squared-distance comparison. Most failures come from off-by-one on inclusive boundaries, not from the algorithm.
Why compare squared distances?+
Square roots introduce floating-point error, and tangent circles must count as touching. Compare dx^2 + dy^2 against (r1+r2)^2 using 64-bit integers. With radii up to 10^9, the squared sum reaches about 4*10^18, which still fits in a signed 64-bit value.
Is the pairwise O(n^2) approach fast enough?+
Yes. With at most 1000 radars, that's about half a million pair checks, which is trivial. You don't need spatial indexing or sorting. Spend your effort on correct inclusive conditions and the wall-touch flags instead.
How do I prepare for this in 48 hours?+
Write union-find from memory once, then solve one grid or graph connectivity problem with it. Rehearse the two wall conditions, y - r <= 0 and y + r >= height. Test the three given examples, especially the empty radars case, which should return true.