Skip to content

Commit 98ce934

Browse files
authored
Update 1439-find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows.js
1 parent 89db8e8 commit 98ce934

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

1439-find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,20 @@ const kthSmallest = function(mat, k) {
1616
if (row === mat.length) return 1;
1717
let totalcnt = 0;
1818
for(let v of mat[row]) {
19-
let cnt = check(row+1, v+sum, limit);
19+
const cnt = check(row + 1, v + sum, limit);
2020
totalcnt += cnt;
2121
if (cnt === 0 || totalcnt > k) break;
2222
}
23-
2423
return totalcnt;
2524
};
2625

2726
while(lo <= hi) {
28-
let m = Math.floor((lo+hi)/2);
29-
let cnt = check(0,0,m);
27+
const m = (lo + (hi - lo) / 2) >> 0;
28+
const cnt = check(0, 0, m);
3029
if (cnt < k) {
31-
lo = m+1;
30+
lo = m + 1;
3231
} else {
33-
hi = m-1;
32+
hi = m - 1;
3433
}
3534
}
3635

0 commit comments

Comments
 (0)