kucheasysa

Algoverse_adesh_18

Jun 14th, 2024
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. class Solution:
  2.     def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
  3.        
  4.         a=[]
  5.         for i in range(len(matrix)):
  6.             if target<= matrix[i][len(matrix[0])-1]:
  7.                 a=matrix[i]
  8.                 break
  9.         for j in range(len(a)):
  10.             if target==a[j]:
  11.                 return True
  12.         else:
  13.             return False
Advertisement
Add Comment
Please, Sign In to add comment