This commit is contained in:
krahets
2023-04-14 04:01:38 +08:00
parent cf431646e9
commit 4d318e8e6b
26 changed files with 469 additions and 295 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ comments: true
```cpp title="linear_search.cpp"
/* 线性查找(数组) */
int linearSearchArray(vector<int>& nums, int target) {
int linearSearchArray(vector<int> &nums, int target) {
// 遍历数组
for (int i = 0; i < nums.size(); i++) {
// 找到目标元素,返回其索引
@@ -190,7 +190,7 @@ comments: true
```cpp title="linear_search.cpp"
/* 线性查找(链表) */
ListNode* linearSearchLinkedList(ListNode* head, int target) {
ListNode *linearSearchLinkedList(ListNode *head, int target) {
// 遍历链表
while (head != nullptr) {
// 找到目标节点,返回之