面試常用基礎算法

目錄

快速排序

#include <iostream>
#include <algorithm>using namespace std;const int N = 1e5 + 10;int n;
int arr[N];void quick_sort(int l, int r) {if (l >= r) return;int mid = l + r >> 1;int val = arr[mid];int p1 = l - 1, p2 = r + 1;while (p1 < p2) {while (arr[++p1] < val);while (arr[--p2] > val);if (p1 < p2) swap(arr[p1], arr[p2]);}quick_sort(l, p2);quick_sort(p2 + 1, r);
}int main() {cin >> n;for (int i = 0; i < n; ++i) cin >> arr[i];quick_sort(0, n - 1);for (int i = 0; i < n; ++i) cout << arr[i] << " ";cout << "\n";return 0;
}

歸并排序

#include <iostream>
#include <algorithm>using namespace std;const int N = 1e5 + 10;int n;
int arr[N], tmp[N];void merge_sort(int l, int r) {if (l >= r) return;int mid = l + r >> 1;merge_sort(l, mid);merge_sort(mid + 1, r);int i = l, j = mid + 1, k = 0;while (i <= mid && j <= r) {if (arr[i] <= arr[j]) tmp[k++] = arr[i++];else tmp[k++] = arr[j++];}while (i <= mid) tmp[k++] = arr[i++];while (j <= r) tmp[k++] = arr[j++];for (i = l; i <= r; ++i) arr[i] = tmp[i - l];
}int main() {cin >> n;for (int i = 0; i < n; ++i) cin >> arr[i];merge_sort(0, n - 1);for (int i = 0; i < n; ++i) cout << arr[i] << " ";cout << "\n";return 0;
}

堆排序

#include <iostream>
#include <algorithm>using namespace std;const int N = 1e5 + 10;int n, k;
int heap[N], sz;void down(int u) {int t = u;int ls = u << 1;int rs = u << 1 | 1;if (ls <= sz && heap[ls] <= heap[t]) t = ls;if (rs <= sz && heap[rs] <= heap[t]) t = rs;if (t != u) {swap(heap[u], heap[t]);down(t);}
}int main() {ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);cin >> n >> k;for (int i = 1; i <= n; ++i) cin >> heap[i];sz = n;for (int i = n >> 1; i >= 1; --i) down(i);while (k--) {int res = heap[1];cout << res << " ";swap(heap[1], heap[sz--]);down(1);}return 0;
}

n n n皇后問題

#include <iostream>
#include <algorithm>
#include <cstring>using namespace std;const int N = 10;int n;
char g[N][N];bool is_valid(int x, int y) {for (int i = 0; i < n; ++i) if (g[i][y] == 'Q') return false;for (int i = 0; i < n; ++i) if (g[x][i] == 'Q') return false;int nx = x, ny = y;while (nx >= 0 && ny >= 0) {if (g[nx][ny] == 'Q') return false;nx--, ny--;}nx = x, ny = y;while (nx < n && ny >= 0) {if (g[nx][ny] == 'Q') return false;nx++, ny--;}nx = x, ny = y;while (nx >= 0 && ny < n) {if (g[nx][ny] == 'Q') return false;nx--, ny++;}nx = x, ny = y;while (nx < n && ny < n) {if (g[nx][ny] == 'Q') return false;nx++, ny++;}return true;
}void dfs(int row, int k) {if (k == 0) {for (int i = 0; i < n; ++i) {for (int j = 0; j < n; ++j) {cout << g[i][j];}cout << "\n";}cout << "\n";return;}// 枚舉列for (int i = 0; i < n; ++i) {if (is_valid(row, i)) {g[row][i] = 'Q';dfs(row + 1, k - 1);g[row][i] = '.';}}
}int main() {cin >> n;for (int i = 0; i < n; ++i) {for (int j = 0; j < n; ++j) {g[i][j] = '.';}}dfs(0, n);return 0;
}

最大和子數組

53.最大和子數組

class Solution {
public:int maxSubArray(vector<int>& nums) {const int N = 1e5 + 10;int arr[N];int f[N];int n = nums.size();for (int i = 0; i < n; ++i) {arr[i + 1] = nums[i];}memset(f, -0x3f, sizeof f);int res = -0x3f3f3f3f;arr[0] = 0;for (int i = 1; i <= n; ++i) {f[i] = max(arr[i], f[i - 1] + arr[i]);res = max(res, f[i]);}return res;}
};

爬樓梯

class Solution {
public:int climbStairs(int n) {const int N = 46;int f[N] = {0};f[0] = 1;f[1] = 1;for (int i = 2; i <= n; ++i) f[i] = f[i - 1] + f[i - 2];return f[n];}
};

中心擴展法求最長回文子序列

516. 最長回文子序列

采用中心擴展法, 分別枚舉所有可能的回文串的中心位置
然后再將回文串長度的類別分為奇數偶數, 分別統計答案

#include <string>
using namespace std;class Solution {
public:int countSubstrings(string s) {int res = 0;int n = s.size();for (int i = 0; i < n; ++i) {int l = i, r = i;while (l >= 0 && r < n && s[l--] == s[r++]) res++;l = i, r = i + 1;while (l >= 0 && r < n && s[l--] == s[r++]) res++;}return res;}
};

分割回文串

131.分割回文串

先用DP預處理所有合法的子串, 然后DFS所有分割方式

#include <iostream>
#include <vector>
#include <cstring>using namespace std;class Solution {
public:const int N = 20;bool f[20][20];void dfs(string &str, vector<vector<string>> &res, vector<string> &tmp, int u) {if (u >= str.size()) {res.push_back(tmp);return;}for (int v = u; v < str.size(); ++v) {if (f[u][v]) {tmp.push_back(str.substr(u, v - u + 1));dfs(str, res, tmp, v + 1);tmp.pop_back();}}}vector<vector<string>> partition(string s) {memset(f, false, sizeof f);int n = s.size();// 預處理回文子串for (int i = 0; i < n; ++i) {f[i][i] = true;if (i + 1 < n && s[i] == s[i + 1]) {f[i][i + 1] = true;}}for (int len = 3; len <= n; ++len) {for (int i = 0; i + len - 1 < n; ++i) {int j = i + len - 1;if (s[i] == s[j] && f[i + 1][j - 1]) {f[i][j] = true;}}}vector<vector<string>> res;vector<string> tmp;dfs(s, res, tmp, 0);return res;}
};

動態規劃求最長回文子序列

516.最長回文子序列

class Solution {
public:int longestPalindromeSubseq(string s) {const int N = 1010;int f[N][N] = {0};int n = s.size();for (int i = 0; i < n; ++i) f[i][i] = 1;for (int len = 2; len <= n; ++len) {for (int i = 0; i + len - 1 < n; ++i) {int j = i + len - 1;if (s[i] == s[j]) f[i][j] = f[i + 1][j - 1] + 2;else f[i][j] = max(f[i + 1][j], f[i][j - 1]);}}return f[0][n - 1];}
};

最長回文子串

5.最長回文子串

動態規劃預處理每個狀態是否是合法的, 同時記錄最長的回文字符串

class Solution {
public:string longestPalindrome(string s) {const int N = s.size() + 10;bool f[N][N];memset(f, false, sizeof f);int n = s.size();for (int i = 0; i < n; ++i) f[i][i] = true;int start = 0, sz = 1;for (int i = 0; i < n; ++i) {int j = i + 1;if (s[i] == s[j]) {f[i][j] = true;start = i, sz = 2;}}for (int len = 3; len <= n; ++len) {for (int i = 0; i + len - 1 < n; ++i) {int j = i + len - 1;if (s[i] == s[j] && f[i + 1][j - 1]) {f[i][j] = true;if (j - i + 1 > sz) {sz = j - i + 1;start = i;}}}}string res = "";for (int i = start; i < start + sz; ++i) res += s[i];return res;}
};

單調棧

42.接雨水

棧底到棧頂的存儲的柱子高度是遞減的, 當新加入的柱子高度大于當前棧頂的高度的時候, 說明能夠形成凹槽, 然后邊彈棧邊計算積水面積

class Solution {
public:int trap(vector<int>& height) {const int N = height.size() + 10;int stack[N], top = 0;int res = 0;for (int i = 0; i < height.size(); ++i) {int val = height[i];while (top && val > height[stack[top]]) {int pre = stack[top--];if (!top) break;// 計算兩個柱子之間的距離int d = i - stack[top] - 1;// 減去凹槽的高度int h = min(height[stack[top]], height[i]) - height[pre];res += h * d;}stack[++top] = i;}return res;}
};

雙指針算法

C - Shortest Duplicate Subarray

問題陳述
給你一個正整數
N N N 和一個長度為 N N N 的整數序列
請判斷 A A A 是否存在一個非空(連續)子數組,它有一個重復值,多次出現在 A A A 中。如果存在這樣的子數組,求最短的子數組的長度。

維護滑動窗口, 使用 s e t set set記錄是否有重復元素, 如果有重復元素縮短左側窗口, 直到沒有重復元素, 然后遞增右側窗口

#include <iostream>
#include <algorithm>
#include <cstring>
#include <unordered_set>using namespace std;const int N = 2e5 + 10, INF = 0x3f3f3f3f;int n, arr[N];
unordered_set<int> s;int main() {ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);cin >> n;for (int i = 0; i < n; ++i) cin >> arr[i];int res = INF;int l = 0;for (int r = 0; r < n; ++r) {while (s.count(arr[r])) {res = min(res, r - l + 1);s.erase(arr[l++]);}s.insert(arr[r]);}if (res == INF) res = -1;cout << res << endl;return 0;
}

11. 盛最多水的容器

貪心策略: 定義兩個指針指向兩側, 每次移動高度較小的那個指針, 這樣能夠圍成的面積有可能變大

class Solution {
public:int maxArea(vector<int>& height) {int res = 0;int l = 0, r = height.size() - 1;while (l < r) {int h = min(height[l], height[r]);res = max(res, h * (r - l));height[l] < height[r] ? l++ : r--;}return res;}
};

LCR 179. 查找總價格為目標值的兩個商品

class Solution {
public:vector<int> twoSum(vector<int>& price, int target) {int l = 0, r = price.size() - 1;vector<int> res;while (l < r) {int sum = price[l] + price[r];if (sum == target) {res.push_back(price[l]);res.push_back(price[r]);break;}else if (sum < target) l++;else r--;}return res;}
};

鏈表中的中間節點

class Solution {
public:ListNode* middleNode(ListNode* head) {//		定義快慢指針, 快指針走到終點, 慢指針走到中間ListNode *u = head;ListNode *v = head;while (u != nullptr) {if (u->next == nullptr) break;u = (u->next)->next;v = v->next;}return v;}
};

判斷鏈表中是否含有環

class Solution {
public:bool hasCycle(ListNode *head) {ListNode *u = head;ListNode *v = head;while (u != nullptr && v != nullptr) {if (u->next == nullptr) break;u = u->next->next;v = v->next;if (u == v) return true;}return false;}
};

尋找鏈表中倒數第k個位置

class Solution {
public:ListNode* trainingPlan(ListNode* head, int cnt) {ListNode *u = head;ListNode *v = head;cnt--;while (cnt--) u = u->next;while (u->next != nullptr) {u = u->next;v = v->next;}return v;}
};

392. 判斷子序列

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>using namespace std;class Solution {
public:bool isSubsequence(string s, string t) {int i = 0, j = 0;int n = s.size(), m = t.size();if (n == 0) return true;while (i < n && j < m) {if (s[i] == t[j]) {if (i == n - 1) {cout << i << endl;return true;}i++;}j++;}return false;}
};

將所有0移動到數組末尾, 同時保證剩余元素相對位置不變

class Solution {
public:void moveZeroes(vector<int>& nums) {int n = nums.size();
//		i是處理好的下一個位置, j遍歷整個數組int i = 0, j = 0;while (j < n) {if (nums[j]) {swap(nums[i], nums[j]);i++;}j++;}}
};

修改 + 分割回文串

1278. 分割回文串 III

f [ i ] [ j ] f[i][j] f[i][j]代表考慮前 i i i個字符并且已經分割了 j j j個回文子串的所有方案的集合

屬性: 修改的最少字符

如何進行集合劃分/狀態轉移
考慮第 j j j個回文子串的起始位置 i 0 i_0 i0?
f [ i ] [ j ] = m i n ( f [ i 0 ] [ j ? 1 ] + c o s t ( S , i 0 + 1 , i ) ) f[i][j] = min(f[i_0][j - 1] + cost(S, i_0 + 1, i)) f[i][j]=min(f[i0?][j?1]+cost(S,i0?+1,i))
時間復雜度: O ( n 3 k ) O(n ^ 3k) O(n3k)

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>using namespace std;const int N = 110;int n;
//f[i][j]考慮前i個字符, 已經分割了j個子串的最小修改字符次數
int f[N][N];class Solution {
public:
//	計算將l到r修改為回文串需要的最小代價int cost(string &s, int l, int r) {int res = 0;for (int i = l, j = r; i < j; ++i, --j) {if (s[i] != s[j]) res++;}return res;}int palindromePartition(string s, int k) {n = s.size();memset(f, 0x3f, sizeof f);f[0][0] = 0;for (int i = 1; i <= n; ++i) {for (int j = 1; j <= min(i, k); ++j) {
//				如果只分割了一個子串, 那么就是從開頭到當前位置if (j == 1) f[i][j] = cost(s, 0, i - 1);
//				枚舉最后一個回文子串的起始位置else {for (int l = j - 1; l < i; ++l) {f[i][j] = min(f[i][j], f[l][j - 1] + cost(s, l, i - 1));}}}}return f[n][k];}
};

滑動窗口

1004. 最大連續1的個數 III

class Solution {
public:int longestOnes(vector<int>& nums, int k) {int n = nums.size();int l = 0, r = 0;int res = 0;int cnt = 0;while (r < n) {if (nums[r] == 0) cnt++;while (cnt > k) {if (nums[l] == 0) cnt--;l++;}res = max(res, r - l + 1);r++;}return res;}
};

替換后最長重復字符

class Solution {
public:int characterReplacement(string s, int k) {int n = s.size();int l = 0, r = 0;
//		記錄每個字符出現的次數int cnt[26] = {0};int max_cnt = 0;int res = 0;while (r < n) {cnt[s[r] - 'A']++;max_cnt = max(max_cnt, cnt[s[r] - 'A']);if (r - l + 1 - max_cnt > k) {cnt[s[l] - 'A']--;l++;}res = max(res, r - l + 1);r++;}return res;}
};

2024. 考試的最大困擾度

class Solution {
public:int get(char c) {if (c == 'F') return 0;return 1;}int maxConsecutiveAnswers(string answerKey, int k) {int n = answerKey.size();int l = 0, r = 0;int cnt[2] = {0};int max_cnt = 0;int res = 0;while (r < n) {int &val = cnt[get(answerKey[r])];val++;max_cnt = max(max_cnt, val);if (r - l + 1 - max_cnt > k) {cnt[get(answerKey[l])]--;l++;}res = max(res, r - l + 1);r++;}return res;}
};

395. 至少有 K 個重復字符的最長子串

外層枚舉的是不同字符的種類

class Solution {
public:int longestSubstring(string s, int k) {int n = s.size();int res = 0;for (int i = 1; i <= 26; ++i) {int cnt[26] = {0};int l = 0, r = 0;int type_cnt = 0;int tmp = 0;while (r < n) {
//				當前窗口中字符類型數量小于等于iif (type_cnt <= i) {int u = s[r] - 'a';if (cnt[u] == 0) type_cnt++;cnt[u]++;if (cnt[u] == k) tmp++;r++;}
//				當前窗口字符數量大于i, 縮小窗口else {int u = s[l] - 'a';if (cnt[u] == k) tmp--;cnt[u]--;if (cnt[u] == 0) type_cnt--;l++;}if (type_cnt == i && tmp == i) res = max(res, r - l);}}return res;}
};

713. 乘積小于 K 的子數組

class Solution {
public:int numSubarrayProductLessThanK(vector<int>& nums, int k) {if (k <= 1) return 0;int n = nums.size();int l = 0, r = 0;int res = 0;int curr = 1;while (r < n) {curr *= nums[r];while (curr >= k) {curr /= nums[l];l++;}
//			以r結尾的子數組的數量res += r - l + 1;r++;}return res;}
};

刪除字符串中所有相鄰的重復項

class Solution {
public:string removeDuplicates(string s) {string res = "";for (char c : s) {if (!res.empty() && res.back() == c) res.pop_back();else res.push_back(c);}return res;}
};

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/79778.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/79778.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/79778.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

相對路徑和絕對路徑解析

在 Linux/Unix 和文件系統中&#xff0c;絕對路徑和相對路徑是描述文件或目錄位置的兩種方式&#xff0c;它們的核心區別在于路徑的起點和使用場景。以下是詳細對比&#xff1a; 目錄 1. 定義與起點 2. 符號與語法 3. 使用場景 4. 實際示例 示例 1&#xff1a;定位文件 示…

【算法數據結構】leetcode37 解數獨

37. 解數獨 - 力扣&#xff08;LeetCode&#xff09; 題目描述&#xff1a; 題目要求每一行 &#xff0c;每一列&#xff0c;每個3*3 的子框只能出現一次。每個格子的數字范圍1-9. 需要遍歷每個空格填入可能的數字&#xff0c;并驗證符合規則。如果符合就填入&#xff0c;不符…

Vector的學習

vector簡介 vector的相關文檔對于想深入了解的同學可以參考這個文檔進行學習。 vector是表示可變大小數組的序列容器。 就像數組一樣&#xff0c;vector也采用的連續存儲空間來存儲元素。也就是意味著可以采用下標對vector的元素進行訪問&#xff0c;和數組一樣高效。但是又不…

Vue常用指令入門

1. v-for 作用&#xff1a;用于遍歷對象或數組 注意&#xff1a;需要提供key屬性&#xff0c;可以提高性能和避免渲染錯誤&#xff0c;值通常為index或item.id <li v-for"(item, index) in items" :key"index">{{ item }} </li>2. v-if,v-el…

在機器視覺檢測中為何選擇線陣工業相機?

線陣工業相機&#xff0c;顧名思義是成像傳感器呈“線”狀的。雖然也是二維圖像&#xff0c;但極寬&#xff0c;幾千個像素的寬度&#xff0c;而高度卻只有幾個像素的而已。一般在兩種情況下使用這種相機&#xff1a; 1. 被測視野為細長的帶狀&#xff0c;多用于滾筒上檢測的問…

線性DP:最長上升子序列(子序列可不連續,子數組必須連續)

目錄 Q1&#xff1a;簡單遍歷 Q2&#xff1a;變式&#xff08;加大數據量&#xff09; Q1&#xff1a;簡單遍歷 Dp問題 狀態表示 f(i,j) 集合所有以第i個數結尾的上升子序列集合-f(i,j)的值存的是什么序列長度最大值max- 狀態計算 &#xff08;其實質是集合的劃分&#xff09;…

【Web前端技術】第二節—HTML標簽(上)

hello&#xff01;好久不見—— 做出一個屬于自己的網站&#xff01; 云邊有個稻草人-個人主頁 Web前端技術—本篇文章所屬專欄 目錄 一、HTML 語法規范 1.1 基本語法概述 1.2 標簽關系 二、HTML 基本結構標簽 2.1 第一個 HTML 網頁 2.2 基本結構標簽總結 三、網頁開發…

論文降重GPT指令-實側有效從98%降低到8%

步驟1&#xff1a;文本接收 指令&#xff1a; 請用戶提供需要優化的文本內容。 對文本進行初步分析&#xff0c;識別文本的基本結構和風格。 操作&#xff1a; 接收并分析用戶提交的文本。 步驟2&#xff1a;文本優化 2.1 連接詞處理 指令&#xff1a; 刪除或替換連接詞&#x…

Jsp技術入門指南【九】詳細講解JSTL

Jsp技術入門指南【九】詳細講解JSTL 前言一、什么是JSTL&#xff1f;&#xff08;JavaServer Pages Standard Tag Library&#xff09;二、使用JSTL前的準備三、核心標簽庫常用標簽詳解1. <c:out>&#xff1a;輸出內容&#xff08;替代<% %>&#xff09;2. <c:i…

Linux操作系統--進程的創建和終止

目錄 1.進程創建 1.1fork()函數初識 1.2寫時拷貝 1. 提升系統效率 2. 隔離錯誤影響 3. 支持并行計算 2.進程終止&#xff1a; 2.1進程退出場景&#xff1a; 2.2進程常見退出方法&#xff1a; 2.3_exit()系統調用接口 2.4exit函數 2.5return退出 1.進程創建 1.1for…

OSPF綜合實驗——企業邊界路由器、LSA收斂

IP劃分粗略記號&#xff0c;方便后續配置 配置IP和環回--->ISP的IP配置和cheat認證---->配置OSPF和RIP---->企業邊界路由網段匯總---->特殊區域---> 缺省路由&#xff0c;重分發---->nat配置---->實現全網通 路由器配置IP和環回地址 <Huawei>sys…

Java【網絡原理】(4)HTTP協議

目錄 1.前言 2.正文 2.1自定義協議 2.2HTTP協議 2.2.1抓包工具 2.2.2請求響應格式 2.2.2.1URL 2.2.2.2urlencode 2.2.3認識方法 2.2.3.1GET與POST 2.2.3.2PUT與DELETE 2.2.4請求頭關鍵屬性 3.小結 1.前言 哈嘍大家好啊&#xff0c;今天來繼續給大家帶來Java中網絡…

Android學習總結之APK打包流程

一、預處理階段&#xff08;編譯前準備&#xff09; 1. AIDL 文件處理&#xff08;進程間通信基礎&#xff09; 流程&#xff1a; 用于實現 Android 系統中不同進程間的通信&#xff08;IPC&#xff09;。在項目構建時&#xff0c;AIDL 編譯器會將 .aidl 文件編譯為 Java 接口…

BDO分廠積極開展“五個一”安全活動

BDO分廠為規范化學習“五個一”活動主題&#xff0c;按照“上下聯動、分頭準備 、差異管理、資源共享”的原則&#xff0c;全面激活班組安全活動管理新模式&#xff0c;正在積極開展班組安全活動&#xff0c;以單元班組形式對每個班組每周組織一次“五個一”安全活動。 丁二醇單…

【音視頻】FLV格式分析

FLV概述 FLV(Flash Video)是Adobe公司推出的?種流媒體格式&#xff0c;由于其封裝后的?視頻?件體積?、封裝簡單等特點&#xff0c;?常適合于互聯?上使?。?前主流的視頻?站基本都?持FLV。采?FLV格式封裝的?件后綴為.flv。 FLV封裝格式是由?個?件頭(file header)和…

Java表達式1.0

Java開發工具 在當今的Java開發領域&#xff0c;IntelliJ IDEA已然成為了眾多開發者心目中的首選利器&#xff0c;它被廣泛認為是目前Java開發效率最快的IDE工具。這款備受矚目的開發工具是由JetBrains公司精心打造的&#xff0c;而JetBrains公司總部位于風景如畫的捷克共和國首…

Map遍歷

第一種遍歷方式鍵找值&#xff1a; 增強for循環&#xff1a; 通過獲取元素中的鍵&#xff0c;get到對應的值&#xff0c;通過增強for循環獲取集合里的鍵&#xff0c;然后用get方法通過鍵獲取值 代碼演示&#xff1a; import java.text.ParseException; import java.util.*;…

內網穿透服務器—FRP

某天某刻空閑的時候跟同事聊的本地的存儲服務如果我想讓其他公網內的用戶使用&#xff08;這個存儲服務只是一個臨時文件傳遞站&#xff0c;碎文件&#xff0c;安全低的&#xff09;&#xff0c;然后我們就探討到了FRP一個比較久遠的技術&#xff0c;來做內網穿透&#xff0c;下…

力扣每日打卡16 781. 森林中的兔子(中等)

力扣 781. 森林中的兔子 中等 前言一、題目內容二、解題方法1. 哈希函數&#xff08;來自評論區大佬的解題方法&#xff09;2.官方題解2.1 方法一&#xff1a;貪心 前言 這是刷算法題的第十六天&#xff0c;用到的語言是JS 題目&#xff1a;力扣 781. 森林中的兔子 (中等) 一、…

基于深度學習的線性預測:創新應用與挑戰

一、引言 1.1 研究背景 深度學習作為人工智能領域的重要分支&#xff0c;近年來在各個領域都取得了顯著的進展。在線性預測領域&#xff0c;深度學習也逐漸興起并展現出強大的潛力。傳統的線性預測方法在處理復雜數據和動態變化的情況時往往存在一定的局限性。而深度學習憑借…