From d5890ecc87b2c9468e661e657357562823e2e91a Mon Sep 17 00:00:00 2001 From: RKS Date: Sat, 10 Oct 2020 13:16:01 +0530 Subject: [PATCH] Added 0074_Search_a_2D_Matrix.py --- LeetCode/0074_Search_a_2D_Matrix.py | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 LeetCode/0074_Search_a_2D_Matrix.py diff --git a/LeetCode/0074_Search_a_2D_Matrix.py b/LeetCode/0074_Search_a_2D_Matrix.py new file mode 100644 index 0000000..9bd7569 --- /dev/null +++ b/LeetCode/0074_Search_a_2D_Matrix.py @@ -0,0 +1,36 @@ +class Solution: + def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: + + def binary_search(arr, target): + low = 0 + high = len(arr)-1 + while low<=high: + mid = low + (high-low)//2 + if arr[mid] == target: + return True + elif arr[mid]