Skip to content

Commit b326d03

Browse files
authored
Update find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows.py
1 parent 8982556 commit b326d03

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ def countArraysHaveSumLessOrEqual(mat, k, r, target): # Time: O(k + m) ~ O(k *
5454
break
5555
return result
5656

57-
MAX_NUM = 5000
58-
left, right = len(mat), len(mat)*MAX_NUM
57+
max_num = max(x for row in mat for x in row)
58+
left, right = len(mat), len(mat)*max_num
5959
while left <= right:
6060
mid = left + (right-left)//2
6161
cnt = countArraysHaveSumLessOrEqual(mat, k, 0, mid)

0 commit comments

Comments
 (0)