Time for a Config Push to Reach Every Data Center
Last updated: November 29, 2026
Quick Overview
Given n data centers and directed links (u, v, latency), a config push starts at center k; return the time until every center has received it, or -1 if some center is unreachable.
0
0
0 solved
Given n data centers and directed links (u, v, latency), a config push starts at center k; return the time until every center has received it, or -1 if some center is unreachable.
Framed around global config propagation across Google's data centers, this checks that you recognize single-source shortest paths with non-negative weights and implement Dijkstra with a heap correctly. Strong candidates note that the answer is the maximum of the shortest distances, not the sum.
What the Interviewer Expects
- Identifies Dijkstra as the right tool for non-negative latencies
- Uses a min-heap with lazy deletion of stale entries
- Returns the max shortest distance, or -1 if any node is unreached
- States complexity in terms of V and E
- Mentions Bellman-Ford if negative weights were possible
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
- Links can fail; return the time if any single link is removed, worst case.
- Each center needs processing time before forwarding; how does the model change?
- What if pushes can start from several centers at once?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Nodes labeled 1..n; edges
(u, v, w)directed with w at least 0. - Output: time when the last node receives the push (max over shortest distances), -1 if some node is unreachable....
High-Level Design
Build an adjacency list. Run Dijkstra from k with a heap of (dist, node). Pop the closest; if already finalized skip it (lazy deletion), otherwise finalize and relax its outgoing edges, pushing any ...