Skip to content

Commit 19b1fb0

Browse files
authored
Update Search a 2D Matrix - Leetcode 74.py
1 parent a8eb54b commit 19b1fb0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Search a 2D Matrix - Leetcode 74/Search a 2D Matrix - Leetcode 74.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
1919
r = t - 1
2020

2121
while l <= r:
22-
m = (l + r) // 2
23-
i = m // n
24-
j = m % n
22+
mid = (l + r) // 2
23+
i = mid // n
24+
j = mid % n
2525
mid_num = matrix[i][j]
2626

2727
if target == mid_num:
2828
return True
2929
elif target < mid_num:
30-
r = m - 1
30+
r = mid - 1
3131
else:
32-
l = m + 1
32+
l = mid + 1
3333

3434
return False
3535

0 commit comments

Comments
 (0)