Most Cell Towers Knocked Offline by One Chain Reaction
Last updated: November 29, 2026
Quick Overview
Each cell tower has a position (x, y) and a failure radius r; when a tower fails, every tower within its radius also fails, and so on. Return the maximum number of towers that can fail if you trigger exactly one.
0
0
0 solved
Each cell tower has a position (x, y) and a failure radius r; when a tower fails, every tower within its radius also fails, and so on. Return the maximum number of towers that can fail if you trigger exactly one.
An onsite question about cascading failures, relevant to reliability work on Google's network and power infrastructure. The key insight the interviewer is waiting for is that the influence relation is directed, since tower A reaching B does not imply B reaches A.
What the Interviewer Expects
- Build a directed graph where i -> j if j is within i's radius
- Explain why union-find on undirected edges is wrong
- Run BFS or DFS from each tower and count reachable nodes
- Use squared distances to avoid floating point
- State O(n^2) edges and O(n^3) worst-case time
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Speed up edge building with a spatial grid or k-d tree.
- Reuse work by collapsing strongly connected components first.
- Which single tower would you reinforce to most reduce the worst cascade?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: list of
(x, y, r), n up to about 100. - Tower i triggers j if the Euclidean distance is at most r_i.
- Output: max number of failed towers from one trigger (including itself)....
High-Level Design
Construct edges i -> j whenever . Squared distance keeps everything in integers. The relation is not symmetric: a tower with a large radius reaches a small o...