04 2022 档案
摘要:1346. 回文平方 #include <iostream> #include <algorithm> #include <cstring> using namespace std; char get(int x) // 将x转化为b进制 { if(x <= 9) return x + '0'; r
阅读全文
摘要:13. 找出数组中重复的数字 class Solution { public: int duplicateInArray(vector<int>& nums) { if(nums.empty()) return -1; unordered_map<int, int> hash; int n = nu
阅读全文
摘要:AcWing PAT甲级树专题 1476. 数叶子结点 #include <iostream> #include <cstring> using namespace std; const int N = 110; int h[N], e[N], ne[N], idx; int n, m; int c
阅读全文
摘要:学习资料 1.单调栈知识 2.算法讲解052【必备】单调栈-上 口诀:大增小减,左从左到右,右从右到左 解释:找某个元素左边或右边第一个比它大的元素,构造单调递增栈,遍历顺序与前面左右相同,要找左边就从左到右遍历,要找右边就从右到左遍历; 找某个元素左边或右边第一个比它小的元素,构造单调递减栈,遍历
阅读全文