Skip to content

Commit 0d91292

Browse files
authored
Update 1514-path-with-maximum-probability.js
1 parent 71f3195 commit 0d91292

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1514-path-with-maximum-probability.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @param {number} end
77
* @return {number}
88
*/
9-
var maxProbability = function (n, edges, succProb, start, end) {
9+
const maxProbability = function (n, edges, succProb, start, end) {
1010
const g = {}
1111
for (let i = 0; i < edges.length; ++i) {
1212
const a = edges[i][0],
@@ -18,7 +18,7 @@ var maxProbability = function (n, edges, succProb, start, end) {
1818
}
1919
const p = new Array(n).fill(0)
2020
p[start] = 1
21-
const pq = new PriorityQueue((a, b) => -p[a] < -p[b])
21+
const pq = new PriorityQueue((a, b) => p[a] > p[b])
2222
pq.push(start)
2323
while (!pq.isEmpty()) {
2424
const cur = pq.pop()

0 commit comments

Comments
 (0)