Most Reliable Delivery Route Across Unreliable Road Segments
Last updated: November 29, 2026
Quick Overview
Each road segment between two intersections has a probability that a courier crosses it without a delay. Assuming independence, return the highest probability of an on-time trip from the restaurant node to the customer node, or 0 if unreachable.
Uber
November 29, 20260
0
0 solved
Each road segment between two intersections has a probability that a courier crosses it without a delay. Assuming independence, return the highest probability of an on-time trip from the restaurant node to the customer node, or 0 if unreachable.
An Uber Eats framed Dijkstra variant for a technical screen. The interviewer checks that you see why Dijkstra still works when maximizing a product of values in [0, 1], and how to implement it with a max-heap.
What the Interviewer Expects
- Recognizes products of probabilities shrink along a path
- Adapts Dijkstra to maximize instead of minimize
- Uses a max-heap via negated keys
- Explains equivalence with -log weights
- Handles unreachable nodes
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 would this approach fail if some multipliers were above 1?
- How would you combine reliability and travel time into one objective?
- How would you handle correlated delays, such as a stadium event affecting several segments?
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, segments as (u, v, p) undirected with 0 <= p <= 1, src, dst. Output: best success probability as a float. Independence means a route's probability is the product of its segments....
High-Level Design
Extending a path can only keep or reduce its probability since every factor is at most 1. That monotonicity is exactly what Dijkstra needs: the most probable unsettled node can never be improved later...