devices[i] = [x, y] is where the i-th device stands. Several devices may share the same spot.
There is also a list of routers: routers[j] = [x, y, r] is a router at (x, y) that reaches anything at distance at most r. A device exactly r away is still in range.
For each router, count the devices within its range, and return those counts in router order.devices=[[0, 0], [2, 0], [3, 4]], routers=[[0, 0, 2], [0, 0, 5]] → [2, 3]
The first router, range 2, reaches [0, 0] and [2, 0], which is exactly on the edge. The second, range 5, covers all three: [3, 4] is exactly 5 away.
devices=[[1, 1], [1, 1]], routers=[[2, 2, 1]] → [0]
Both devices share one spot, but it is √2 > 1 away, so the router reaches neither.
devices.length ≤ 500devices[i].length == 2, 0 ≤ x, y ≤ 500routers.length ≤ 500routers[j].length == 3, 0 ≤ x, y ≤ 500, 1 ≤ r ≤ 500devices=[[0, 0], [2, 0], [3, 4]], routers=[[0, 0, 2], [0, 0, 5]]
[2, 3]
Run checks the first 3 tests in your browser. Submit checks all 48 tests on the server, hidden ones included.