Trains the technique from
LeetCode 1828Queries on Number of Points Inside a CircleThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A survey grid carries fixed sensors. sensors[i] = [x, y] gives the integer coordinates of sensor i; two sensors may share a position.
A radar makes a series of circular sweeps. scans[j] = [x, y, r] describes a sweep centred at (x, y) with radius r. A sensor is covered by that sweep when its straight-line distance to the centre is at most r. A sensor lying exactly on the circle of radius r counts as covered.
Go through the sweeps in the order listed, work out how many sensors each one covers, and give back those totals as a single list. Two sensors on the same position are tallied separately.
Example 1
The first sweep reaches sensor (7, 2), which sits a distance of about 1.41 from (6, 3). The second reaches sensor (10, 10), about 1.41 from (9, 9). The third covers no sensor at all, since the nearest is (6, 6) at about 8.49 from the origin.
Example 2
Sensors (3, 4) and (0, 5) are both exactly 5 from the centre, so both count as covered. Sensor (4, 4) is about 5.66 away and is not.
Example 3
The first sweep is centred on the position two sensors share, so it covers both of them. The second sweep has a radius of 9 and reaches all three sensors.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def sensors_in_range(sensors: list[list[int]], scans: list[list[int]]) -> list[int]:public int[] sensorsInRange(int[][] sensors, int[][] scans)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.