
算法题
ColaForced
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
20220323华为笔试
1 #include <vector> #include <queue> #include <iostream> using namespace std; int help(vector<int>& num){ vector<bool> is_used(num.size(), false); queue<int> q; q.push(0); is_used[0] = true; int原创 2022-03-23 21:03:22 · 654 阅读 · 0 评论 -
acwing笔记
文章目录基础知识快速排序归并排序二分查找基础数据结构数组模拟单链表trie字符串统计并查集堆模板搜索和图论邻接表数组实现dfsbfskmp最短路最小生成树二分图数学知识动态规划dp背包问题贪心 基础知识 快速排序 /** * @brief: 快速排序: 递归,分治 * @time cpl: O(nlog n) * @space cpl: O(1) * @trouble: **/ template <typename type> void quick_sort_helper(type原创 2022-03-19 15:45:06 · 1755 阅读 · 0 评论 -
20220303蔚来笔试
1 #include <iostream> #include <algorithm> #include <cstring> #include <string> using namespace std; const int N = 110; int num[N]; int v; int main(){ int t; int idx = 0; int mx = -1; while(cin >> t){原创 2022-03-12 21:04:41 · 1012 阅读 · 0 评论 -
20220305网易笔试
1 #include <vector> const int N = 200010; int p[N]; int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } class Solution { public: bool validPath(int n, vector<vector<int> >& sides, int start, int end) {原创 2022-03-12 21:04:05 · 206 阅读 · 0 评论 -
20220305美团笔试
1 #include <iostream> #include <set> #include <vector> #include <algorithm> using namespace std; const int N = 200010; bool num[N]; int main(){ int n; scanf("%d", &n); for(int i=0; i<n; i++){ int t; scanf(原创 2022-03-12 21:03:32 · 392 阅读 · 0 评论 -
20220307shopee笔试
1 乘积最大子数组 详细描述 给你一个整数数组 nums ,请在时间复杂度为O(n) 下找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积 其他 时间限制: 1000ms 内存限制:256.0MB 输入输出示例 示例1 输入 复制 [2,3,-2,4,-1] 输出 复制 48 class Solution { public: /** * Note: 类名、方法名、参数名已经指定,请勿修改 * * * 找到数组原创 2022-03-12 21:02:39 · 476 阅读 · 1 评论 -
20220312完美世界笔试
1 // 可以引入的库和版本相关请参考 “环境说明” #include <iostream> #include <unordered_map> #include <string> using namespace std; string solution(string str) { string res = ""; if(str.empty()) return res; unordered_map<string, int> fmp;原创 2022-03-12 21:01:21 · 462 阅读 · 0 评论