04 2024 档案
摘要:计算今天星期几int getDayOfWeek(int year, int month, int day) { if (month < 3) { month += 12; year--; } int h = (day + (13 * (month + 3)) / 5 + year + year /
阅读全文
摘要:左值引用:对等式int a = 5的a的引用,如int& b = a;(const的左值引用是可以引用右值的,如const int& b = 5) 右值引用:对上面等式中的5的引用,如int&& b = 5; 注意到右指引用其实是左值,左值通过move变成右值 完美转发:经过forward转发的量是
阅读全文
摘要:TreeNode* deleteNode(TreeNode* root, int key) { if (root == nullptr) return root; // 第一种情况:没找到删除的节点,遍历到空节点直接返回了 if (root->val == key) { // 第二种情况:左右孩子都
阅读全文
摘要:#include<iostream> #include <ranges> #include <type_traits> #include <vector> #include <algorithm> #include <string> #include <queue> using namespace
阅读全文
摘要:#include<iostream> #include <type_traits> #include <vector> #include <algorithm> using namespace std; void getMixHeap(vector<int>& nums, int n, int i)
阅读全文
摘要:#include<iostream> #include <type_traits> #include <vector> using namespace std; void quick(vector<int>& nums, int start, int end) { if(start >= end)
阅读全文
摘要:#include<iostream> #include <vector> #include <memory> using namespace std; struct node { int val; node* next; node(int val) : val(val), next(NULL) {}
阅读全文
摘要:https://learngitbranching.js.org/?locale=zh_CN
阅读全文
摘要:图需要注意的点 图的dfs遍历有两种写法,一种是进去之前就给要进去的点标记,另一种是进去dfs函数之后再进行标记 图的bfs(层序遍历)和树的层序不一样的地方在于,树是需要记录每一层的个数的,所以有一个记录的操作。 有一些题目看似不是图的题目,但是转换一下角度就会发现是理解的问题。
阅读全文

浙公网安备 33010602011771号