Python/공부하며적어놓는기록장
[Leet Code] 7. Search a 2D Matrix
LeetCode 74번 문제는 이진탐색(Binary Search)를 통해 문제를 쉽게 해결할 수 있다. class Solution: def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: m = len(matrix) if m == 0: return False n = len(matrix[0]) # binary search left, right = 0, m * n - 1 while left
2021. 2. 3. 18:24
최근댓글