猫头鹰的咖啡馆
猫头鹰的咖啡馆
全部文章
题解
归档
标签
去牛客网
登录
/
注册
猫头鹰的咖啡馆的博客
全部文章
/ 题解
(共163篇)
题解 | #求1+2+3+...+n# 10-29 NO 9
class Solution { public: int Sum_Solution(int n) { int sum = 0; while(n >= 0) { sum += (n--); } ...
C++
2021-10-29
0
291
题解 | #把数组排成最小的数# 10-29 NO 8 熟练使用cmp
class Solution { public: static bool cmp(string &a, string &b) { return a + b < b + a; } string PrintMinNumber(vector&l...
C++
2021-10-29
1
299
题解 | #字符串的排列# 10-29 NO 7 使用set去重是很聪明的想法
class Solution { public: set<string>ret; void dfs(string str, int s) { if (s == str.size() - 1) { ret.insert(str); ...
C++
2021-10-29
0
294
题解 | #斐波那契数列# 10-29 NO 6 凑次数
class Solution { public: int Fibonacci(int n) { if(n == 1 || n == 2) { return 1; } vector<int> dp(n + 1)...
C++
2021-10-29
0
268
题解 | #二叉树的下一个结点# 10-29 NO 5 画图+分析+读题
/* struct TreeLinkNode { int val; struct TreeLinkNode *left; struct TreeLinkNode *right; struct TreeLinkNode *next; TreeLinkNode(i...
C++
2021-10-29
0
408
题解 | #从上往下打印二叉树# 10-29 NO 4 层次遍历
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ /* ...
C++
2021-10-29
0
314
题解 | #二叉树中和为某一值的路径# 10-29 NO 3 (还是要自己尝试一下)
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ /* ...
C++
2021-10-29
0
366
题解 | #树的子结构#10-29 NO 2
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class ...
C++
2021-10-29
0
392
题解 | #二叉树的深度# 10-29- N01
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } };*/ class ...
C++
2021-10-29
0
305
题解 | #删除有序链表中重复的元素-II# 做题目要有自己的思路
/** * struct ListNode { * int val; * struct ListNode *next; * }; */ /* 1,哨兵节点 2,设置curr指向head,prev指向哨兵节点 3,while(curr && curr->next) { ...
C++
2021-10-28
0
293
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页