leetcode/74-240602-pass/main.py

13 lines
403 B
Python
Raw Normal View History

2024-06-02 21:25:22 +02:00
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
ind = len(matrix) - 1
for x, l in enumerate(matrix):
if l[0] < target: continue
if l[0] == target: return True
if x != 0: ind = x - 1
break
l = matrix[ind]
print(l)
if target in l:
return True
return False