文章分类 -  手撕+机考

摘要:前缀树的题目描述 https://leetcode.cn/problems/implement-trie-prefix-tree/description/ 代码 // 定义 Node 类 struct Node { unordered_map<char, Node*> children; // 存储 阅读全文
posted @ 2024-08-19 21:41 铜锣湾陈昊男 阅读(8) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2024-07-09 00:03 铜锣湾陈昊男 阅读(4) 评论(0) 推荐(0)
摘要:计算今天星期几int getDayOfWeek(int year, int month, int day) { if (month < 3) { month += 12; year--; } int h = (day + (13 * (month + 3)) / 5 + year + year / 阅读全文
posted @ 2024-04-25 23:02 铜锣湾陈昊男 阅读(16) 评论(0) 推荐(0)
摘要:TreeNode* deleteNode(TreeNode* root, int key) { if (root == nullptr) return root; // 第一种情况:没找到删除的节点,遍历到空节点直接返回了 if (root->val == key) { // 第二种情况:左右孩子都 阅读全文
posted @ 2024-04-14 15:48 铜锣湾陈昊男 阅读(8) 评论(0) 推荐(0)
摘要:#include<iostream> #include <type_traits> #include <vector> #include <algorithm> using namespace std; void getMixHeap(vector<int>& nums, int n, int i) 阅读全文
posted @ 2024-04-12 21:59 铜锣湾陈昊男 阅读(4) 评论(0) 推荐(0)
摘要:#include<iostream> #include <type_traits> #include <vector> using namespace std; void quick(vector<int>& nums, int start, int end) { if(start >= end) 阅读全文
posted @ 2024-04-11 22:16 铜锣湾陈昊男 阅读(11) 评论(0) 推荐(0)
摘要:#include<iostream> #include <vector> #include <memory> using namespace std; struct node { int val; node* next; node(int val) : val(val), next(NULL) {} 阅读全文
posted @ 2024-04-11 15:26 铜锣湾陈昊男 阅读(7) 评论(0) 推荐(0)