Most Reliable Route Through Links With Known Success Probabilities
Last updated: November 29, 2026
Quick Overview
Each undirected network link between services has a probability of delivering a message successfully, independent of the others. Return the highest success probability of any path from src to dst, or 0 if dst is unreachable.
Microsoft
November 29, 20260
0
0 solved
Each undirected network link between services has a probability of delivering a message successfully, independent of the others. Return the highest success probability of any path from src to dst, or 0 if dst is unreachable.
A Microsoft technical screen problem that checks whether you can adapt Dijkstra to a multiplicative objective. Interviewers expect you to justify why the greedy pop order still holds when weights are probabilities in [0, 1].
What the Interviewer Expects
- Model the problem as a max-product path
- Use a max-heap variant of Dijkstra
- Explain why probabilities in [0, 1] make the greedy choice valid
- Mention the log transform to standard shortest paths
- Skip stale heap entries
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
- What breaks if some edge weight could exceed 1?
- How would you return the path itself?
- How do you handle very small probabilities that underflow?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Inputs: n nodes, undirected links
[u, v, p]with 0 <= p <= 1, src and dst. - Path probability is the product of its link probabilities.
- Output: the maximum probability, or 0.0 if unreachable....
High-Level Design
Multiplying by a number in [0, 1] never increases a value, just as adding a non-negative weight never decreases a distance. That monotonicity is exactly what Dijkstra needs: once a node is popped with...