Most Reliable Network Path Between Two Data Centers

Last updated: November 29, 2026

Quick Overview

Links between data centers each succeed independently with a given probability. Find the maximum probability that a packet travels from start to end along a single path, or 0 if no path exists.

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

0

0

0 solved


Links between data centers each succeed independently with a given probability. Find the maximum probability that a packet travels from start to end along a single path, or 0 if no path exists.

AWS backbone routing cares about path reliability, not just latency. The interviewer checks whether you can adapt Dijkstra to maximize a product of probabilities and justify why that greedy choice is still safe.

What the Interviewer Expects
  • Recognize path reliability is a product of edge probabilities
  • Use a max-heap Dijkstra since probabilities are at most 1 and products never increase
  • Mention the equivalent transform to minimizing the sum of negative logs
  • Stop early when the target is popped
  • Return 0 for unreachable targets
Key Topics to Cover
Dijkstra
max-product paths
log transform
undirected weighted graphs
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
  • Why would this break if some edge 'probability' could exceed 1?
  • How would you find the most reliable path that avoids a specific data center?
  • How would you compute reliability when two disjoint paths can both be used?
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 nodes, undirected edges (a, b) with success probabilities p in [0, 1], start, and end. Output: the best product of probabilities over all simple paths, as a float, or 0.0 when unrea...

High-Level Design

Multiplying by a value in [0, 1] can only keep or reduce a path's reliability, the same monotonic property that non-negative weights give in Dijkstra. So run Dijkstra with a max-heap (negate values fo...


Submit Your Answer
Markdown supported