mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-15 16:36:06 +00:00
build
This commit is contained in:
@@ -49,7 +49,7 @@ comments: true
|
||||
=== "Python"
|
||||
|
||||
```python title="linear_search.py"
|
||||
def linear_search_array(nums: List[int], target: int) -> int:
|
||||
def linear_search_array(nums: list[int], target: int) -> int:
|
||||
""" 线性查找(数组) """
|
||||
# 遍历数组
|
||||
for i in range(len(nums)):
|
||||
@@ -206,7 +206,7 @@ comments: true
|
||||
=== "Python"
|
||||
|
||||
```python title="linear_search.py"
|
||||
def linear_search_linkedlist(head: ListNode, target: int) -> Optional[ListNode]:
|
||||
def linear_search_linkedlist(head: ListNode, target: int) -> ListNode | None:
|
||||
""" 线性查找(链表) """
|
||||
# 遍历链表
|
||||
while head:
|
||||
|
||||
Reference in New Issue
Block a user