Skip to content

Commit

Permalink
Update 1514-path-with-maximum-probability.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
a93a authored May 17, 2023
1 parent cd54717 commit f01dcc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kotlin/1514-path-with-maximum-probability.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class Solution {
add(start to 1.0)

while (isNotEmpty()) {
val (node, currCost) = poll()
val (node, currProb) = poll()
visited.add(node)

if (node == end) return currCost
if (node == end) return currProb

adj[node]?.forEach {
if (it.first !in visited) {
add(it.first to currCost * it.second)
add(it.first to currProb * it.second)
}
}
}
Expand Down

0 comments on commit f01dcc8

Please sign in to comment.