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.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

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
Backtracking
Graph coloring
Constraint satisfaction
Symmetry breaking
Heuristics
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported