Compare commits

...

6 Commits

Author SHA1 Message Date
a432670752 vault backup: 2025-09-13 16:03:27 2025-09-13 16:03:27 +08:00
ca7709d9d8 vault backup: 2025-09-13 09:23:56 2025-09-13 09:23:56 +08:00
8649325b7b vault backup: 2025-09-10 23:21:26 2025-09-10 23:21:26 +08:00
0863bde155 vault backup: 2025-09-10 22:51:26 2025-09-10 22:51:26 +08:00
8b0126ecb3 vault backup: 2025-09-10 10:23:05 2025-09-10 10:23:05 +08:00
1fac510f07 vault backup: 2025-09-10 10:08:06 2025-09-10 10:08:06 +08:00
3 changed files with 70 additions and 8 deletions

View File

@@ -27,5 +27,8 @@
"publish": false,
"sync": false,
"bookmarks": true,
"properties": false
"properties": false,
"webviewer": false,
"footnotes": false,
"bases": true
}

View File

@@ -13,12 +13,12 @@
"state": {
"type": "markdown",
"state": {
"file": "Research/FSL/提示工程.md",
"file": "Books/代码随想录/代码模版.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "提示工程"
"title": "代码模版"
}
}
]
@@ -70,8 +70,8 @@
"state": {
"type": "starred",
"state": {},
"icon": "lucide-file",
"title": "Plugin no longer active"
"icon": "lucide-ghost",
"title": "starred"
}
},
{
@@ -185,6 +185,7 @@
},
"left-ribbon": {
"hiddenItems": {
"bases:Create new base": false,
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"templates:Insert template": false,
@@ -198,8 +199,9 @@
},
"active": "229ca4be3afd5932",
"lastOpenFiles": [
"Paper/FSL Image Classification/Context Attribute words for Prompt Tuning.md",
"Books/代码随想录/代码模版.md",
"Research/FSL/提示工程.md",
"Paper/FSL Image Classification/Context Attribute words for Prompt Tuning.md",
"Research/FSL",
"Research",
"conflict-files-obsidian-git.md",
@@ -234,7 +236,6 @@
"Books/动手学深度学习/基础概念.md",
"liangOpenVocabularySemanticSegmentation2023.md",
"Books/HDLBits/Verilog.md",
"Record/Linux/常用软件.md",
"Books/编译原理/Overview.md"
"Record/Linux/常用软件.md"
]
}

View File

@@ -0,0 +1,58 @@
# 数组
## 二分
```python
def binary_search(nums, target):
left, right = 0, len(nums) - 1
while left <= right:
mid = left + (right - left) // 2 # 防止溢出
if nums[mid] == target:
return mid # 找到目标,返回索引
elif nums[mid] < target:
left = mid + 1 # 目标在右半部分
else:
right = mid - 1 # 目标在左半部分
return -1 # 未找到目标
# 左右边界
def left_bound(nums, target):
left, right = 0, len(nums) - 1
while left <= right:
mid = left + (right - left) // 2
if nums[mid] < target:
left = mid + 1
else:
right = mid - 1
return left if left < len(nums) and nums[left] == target else -1
def right_bound(nums, target):
left, right = 0, len(nums) - 1
while left <= right:
mid = left + (right - left) // 2
if nums[mid] <= target:
left = mid + 1
else:
right = mid - 1
return right if right >= 0 and nums[right] == target else -1
```
## 滑动窗口
```python
def lengthOfLongestSubstring(s: str) -> int:
left = 0
window = {}
result = 0
for right in range(len(s)):
char_right = s[right]
window[char_right] = window.get(char_right, 0) + 1
# 当窗口中有重复字符时,收缩窗口
while window[char_right] > 1:
char_left = s[left]
window[char_left] -= 1
if window[char_left] == 0:
del window[char_left]
left += 1
result = max(result, right - left + 1)
return result
```