宁静的冬日
宁静的冬日
全部文章
分类
python学习(4)
代码笔记(4)
题解(83)
归档
标签
去牛客网
登录
/
注册
宁静的冬日的博客
全部文章
(共91篇)
题解 | #二叉树中和为某一值的路径(二)#
class Solution { public: vector<int>path; vector<vector<int>>result; int nowlen,target; void dfs(TreeNode* root){ ...
C++
2022-04-04
0
322
题解 | #二叉搜索树的后序遍历序列#
class Solution { public: vector<int>v; bool helper(int head,int tail){ if(head>tail)return true; if(head==tail)return...
C++
2022-04-04
0
313
题解 | #从上往下打印二叉树#
class Solution { public: vector<int> PrintFromTopToBottom(TreeNode* root) { if(root==NULL)return {}; queue<TreeNode*...
C++
2022-04-04
0
316
题解 | #包含min函数的栈#
class Solution { public: int minnum; stack<int>s; vector<int>minv;//存储当前的最小值 Solution(){ minv.push_back(10001); ...
C++
2022-04-04
0
271
题解 | #二叉树的深度#
class Solution { public: int TreeDepth(TreeNode* pRoot) { if(pRoot==NULL)return 0; return 1+max(TreeDepth(pRoot->left),TreeDept...
C++
2022-04-04
0
290
题解 | #栈的压入、弹出序列#
class Solution { public: bool IsPopOrder(vector<int> pushV,vector<int> popV) { stack<int> s; int index=0; ...
C++
栈
2022-04-04
0
360
题解 | #顺时针打印矩阵#
class Solution { public: vector<int>v; vector<vector<int> > mv; int n,m; void func(int k){ //边界条件 if...
C++
2022-04-04
0
264
题解 | #对称的二叉树#
class Solution { public: bool helper(TreeNode*p,TreeNode*q){ if(p==NULL)return(q==NULL); if(q==NULL)return false; ...
C++
2022-04-03
0
287
题解 | #合并两个排序的链表#
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public: ListNode* Merge...
C++
2022-04-03
0
276
题解 | #调整数组顺序使奇数位于偶数前面(一)#
时间复杂度:O(n2) 空间复杂度:O(1) 思想:类似于冒泡排序,从头到尾扫面,如果偶数在前,奇数在后,则交换,循环n次即可 class Solution { public: vector<int> reOrderArray(vector<int>&...
C++
2022-04-03
0
340
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页