Most Reliable Route Through a Lossy Network
Last updated: November 29, 2026
Quick Overview
An undirected network has links with success probabilities. Return the highest probability that a packet travels from start to end along a single path, where a path's probability is the product of its link probabilities.
0
0
0 solved
An undirected network has links with success probabilities. Return the highest probability that a packet travels from start to end along a single path, where a path's probability is the product of its link probabilities.
A Google onsite variation on shortest path, set in datacenter networking. The interviewer wants to see the candidate recognize a max-product path as Dijkstra with a max-heap, or as shortest path on -log(p).
What the Interviewer Expects
- Recognizes maximizing a product of values in [0, 1]
- Uses a max-heap Dijkstra or -log transform
- Explains why multiplying by p <= 1 keeps Dijkstra valid
- Returns 0 when unreachable
- States O(E log V)
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
- Why does this fail if some probabilities exceeded 1?
- Find the top two most reliable disjoint paths
- What if probabilities change in real time?
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 nodes, undirected edges with probability
pin [0, 1], start and end. - Output: maximum product of probabilities over paths from start to end, or 0.0 if none....
High-Level Design
Multiplying by a number in [0, 1] can only lower a path's score, which is the same monotonicity Dijkstra relies on for adding non-negative weights. So run Dijkstra with a max-heap: store `(-prob, node...