# Search a 2D Matrix (Leetcode 74)

Problem Link: <https://leetcode.com/problems/search-a-2d-matrix/>

```python
class Solution:
    def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
        
        m=len(matrix)
        n=len(matrix[0])
        i=0
        j=n-1
        while(i<m and j>=0):
            if(matrix[i][j]==target):
                return True
            elif(matrix[i][j]<target):
                i+=1
            elif(matrix[i][j]>target):
                j-=1
        
        return False
```
