Time for a Config Push to Reach Every Host in a Region

Last updated: November 29, 2026

Quick Overview

A configuration update starts at one host and propagates along directed links, each with a transmission delay in milliseconds. Return the time until every host has received it, or -1 if some host can never receive it.

Amazon
Coding & Algorithms
Software Engineer
Amazon
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


A configuration update starts at one host and propagates along directed links, each with a transmission delay in milliseconds. Return the time until every host has received it, or -1 if some host can never receive it.

AWS teams care about how fast a change fans out across a fleet, which maps directly to single-source shortest paths. The interviewer checks that you pick Dijkstra for non-negative weights, implement it with a heap and lazy deletion, and take the maximum of the final distances.

What the Interviewer Expects
  • Model hosts as nodes and links as weighted directed edges
  • Run Dijkstra from the source with a min-heap
  • Skip stale heap entries instead of decreasing keys
  • Answer is the max distance, or -1 if any host is unreached
  • State O((V + E) log V) complexity
Key Topics to Cover
Dijkstra
weighted graphs
min-heap
single-source shortest paths
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
  • What if some links have zero delay or the graph is huge but sparse?
  • How would you report the critical path that determines the answer?
  • What changes if delays can be negative, for example clock skew corrections?
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 hosts labeled 1..n, a list of edges (u, v, w) meaning u sends to v after w ms (w >= 0), and the start host k. Output: the minimum time at which all hosts have the update, which is the l...

High-Level Design

Build an adjacency list. Keep dist as a dictionary of finalized distances. Push (0, k) onto a heap. Pop the smallest tentative distance; if that host is already finalized, skip it; otherwise final...


Submit Your Answer
Markdown supported