![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法题
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 · 556 阅读 · 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 · 1618 阅读 · 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 · 948 阅读 · 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 · 158 阅读 · 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 · 322 阅读 · 0 评论 -
20220307shopee笔试
1乘积最大子数组详细描述给你一个整数数组 nums ,请在时间复杂度为O(n) 下找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积其他时间限制: 1000ms内存限制:256.0MB输入输出示例示例1输入复制[2,3,-2,4,-1]输出复制48class Solution {public: /** * Note: 类名、方法名、参数名已经指定,请勿修改 * * * 找到数组原创 2022-03-12 21:02:39 · 397 阅读 · 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 · 400 阅读 · 0 评论