Assign K Frequencies to Cell Towers So Neighbors Never Clash
Last updated: November 29, 2026
Quick Overview
Given an interference graph of cell towers and k available frequencies, assign a frequency to every tower so that no two interfering towers share one. Return an assignment or report that none exists.
0
0
0 solved
Given an interference graph of cell towers and k available frequencies, assign a frequency to every tower so that no two interfering towers share one. Return an assignment or report that none exists.
A Google onsite graph-coloring problem, the kind that comes up when talking about spectrum planning for Google Fi or similar networks. The interviewer checks a correct k-coloring backtracker, sensible vertex ordering, and the symmetry trick of never trying more than one unused color.
What the Interviewer Expects
- Colors vertices one at a time, checking only already-colored neighbors
- Orders vertices by degree (or DSATUR) to fail fast
- Breaks color symmetry by allowing at most one previously unused color per step
- Handles disconnected graphs
- Acknowledges k-coloring is NP-complete for k >= 3
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
- Implement the DSATUR ordering (most saturated vertex first).
- How would you find the minimum k?
- How does the problem change for k = 2, and what is the linear-time algorithm?
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: n towers (0..n-1), an edge list of interfering pairs, and k.
- Output: a list
color[v]in 0..k-1 with adjacent towers different, or None. - n up to about 50 with sparse edges....
High-Level Design
Build adjacency lists. Order vertices by degree descending: high-degree towers are hardest to place, so we decide them first.
DFS over that order. For vertex v, collect colors used by already-colored...