Code Room
CodingMediumcod-g515
Subject Shortest pathLevel Mid–Senior~30 minCommon in Reliability & on-call interviewsIndustries Software development

Question

A network has n nodes (0..n-1) and undirected links; edges[i] = [a, b] with success probability probs[i] (a float in [0,1]) that a message survives that link. The reliability of a path is the product of its link probabilities. Return the maximum reliability of any path from start to end, or 0.0 if none exists. start may equal end (reliability 1.0). There are at most 10^4 edges.

Implement
max_reliability(n: int, edges: list[list[int]], probs: list[float], start: int, end: int) → float
Examples
in[3,[[0,1],[1,2],[0,2]],[0.5,0.5,0.2],0,2]out0.25
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.