From f4e767627b19a9596cfeb46e5f8f30ea7a06063e Mon Sep 17 00:00:00 2001 From: sean0407 Date: Sat, 10 Oct 2026 15:56:30 +0800 Subject: [PATCH] Fix matrix binary search at row starts --- matrix/binary_search_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix/binary_search_matrix.py b/matrix/binary_search_matrix.py index 6f203b7a3484..c9668a9438c1 100644 --- a/matrix/binary_search_matrix.py +++ b/matrix/binary_search_matrix.py @@ -43,7 +43,7 @@ def mat_bin_search(value: int, matrix: list) -> list: index = 0 if matrix[index][0] == value: return [index, 0] - while index < len(matrix) and matrix[index][0] < value: + while index < len(matrix) and matrix[index][0] <= value: r = binary_search(matrix[index], 0, len(matrix[index]) - 1, value) if r != -1: return [index, r]