Grokking Graph Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Path with Maximum Probability (medium)
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

You are given an undirected graph with n nodes labeled from 0 to n-1. The graph is described using an edge list, where each edge connects two nodes a and b with a probability of success of traversing that edge succProb[i].

Given two nodes start and end, find the path with the maximum probability of success to go from start to end and return its success probability.

The result should be accurate within a margin of 1e<sup>-5</sup>.

Examples

Example 1:

  • Input:
    • n = 5

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible