The Maximum Number of Darts Inside of a Circular Dartboard coding problem gives you a set of dart positions on a 2D plane and a radius r. You need to place a circular dartboard of radius r anywhere on the plane to maximize the number of darts that land on or inside the circle. This is a computational geometry problem requiring careful circle placement optimization.
Meta uses this problem to test candidates' understanding of computational geometry and the insight that the optimal circle placement always has at least two darts on its boundary (or a single dart for the degenerate case). This observation reduces the infinite search space to a finite O(n²) set of candidate circles, making the problem tractable with O(n³) or O(n² log n) algorithms.
Geometry with circle intersection enumeration: The key insight: the optimal circle either contains only 1 dart (place circle centered at that dart) or has ≥ 2 darts on its boundary. For every pair of darts (i, j) within distance 2r of each other, the circle of radius r passing through both has exactly 2 center positions. Enumerate all such candidate centers (O(n²) pairs → O(n²) centers). For each candidate center, count darts within radius r (O(n)). Total: O(n³).
To compute the two circle centers given two points and radius r:
Darts: [(−2,0), (2,0), (0,2)], r = 2.
All three darts lie on the circle of radius 2 centered at (0,0).
dist <= r + 1e-6).For the Array Math Geometry interview pattern, always start geometric circle-placement problems with the observation: "the optimal circle's boundary passes through some of the input points." This reduces infinite continuous optimization to finite discrete enumeration. Pair this with careful floating-point handling (epsilon comparisons) and your solution will be both correct and robust.