You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
not really a bug, but you probably want to change the problem to return the indices, not just True False or this simple code works and no need for binary search:
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
for i in range(len(matrix)):
if target in matrix[i]:
return True
return False
The text was updated successfully, but these errors were encountered:
Bug Report for https://neetcode.io/problems/search-2d-matrix
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
not really a bug, but you probably want to change the problem to return the indices, not just True False or this simple code works and no need for binary search:
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
for i in range(len(matrix)):
if target in matrix[i]:
return True
return False
The text was updated successfully, but these errors were encountered: