文章分类 - 手撕+机考
摘要:前缀树的题目描述 https://leetcode.cn/problems/implement-trie-prefix-tree/description/ 代码 // 定义 Node 类 struct Node { unordered_map<char, Node*> children; // 存储
阅读全文
摘要:https://www.kamacoder.com/problempage.php?pid=1051 #include <bits/stdc++.h> using namespace std; int k, n; struct node { int val; node* left; node* ri
阅读全文
摘要:计算今天星期几int getDayOfWeek(int year, int month, int day) { if (month < 3) { month += 12; year--; } int h = (day + (13 * (month + 3)) / 5 + year + year /
阅读全文
摘要:TreeNode* deleteNode(TreeNode* root, int key) { if (root == nullptr) return root; // 第一种情况:没找到删除的节点,遍历到空节点直接返回了 if (root->val == key) { // 第二种情况:左右孩子都
阅读全文
摘要:#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) {}
阅读全文

浙公网安备 33010602011771号