Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
leetcode: finished #74
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Aug 4, 2023
1 parent 3c673f8 commit dee1aff
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions content/leetcode/2023/8.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,37 @@ title: "2023.8"
draft: false
---

# 2023.8.4

```python
#
# @lc app=leetcode.cn id=74 lang=python3
#
# [74] 搜索二维矩阵
#

# @lc code=start
from typing import List


class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
if not matrix or not matrix[0]:
return False
row, col = 0, len(matrix[0]) - 1
while row <= len(matrix) - 1 and col >= 0:
if matrix[row][col] > target:
col -= 1
elif matrix[row][col] < target:
row += 1
elif matrix[row][col] == target:
return True
return False


# @lc code=end
```

# 2023.8.3

```python
Expand Down

0 comments on commit dee1aff

Please sign in to comment.