a天河朔夜a
a天河朔夜a
全部文章
分类
归档
标签
去牛客网
登录
/
注册
a天河朔夜a的博客
全部文章
(共72篇)
题解 | #用两个栈实现队列#
class Solution { public: void push(int node) { stack1.push(node); } int pop() { int val; if(!stack2.empty())val=s...
2023-03-15
0
217
题解 | #输出二叉树的右视图#
class Solution { public: int result[10010], cnt = 1, len = 0, ind = 1; void build(int i, vector<int>pre, int l, int r, vector<int&g...
2023-03-15
0
229
题解 | #重建二叉树#
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x),...
2023-03-15
0
224
题解 | #二叉搜索树与双向链表#
class Solution { public: TreeNode* dfs(TreeNode* pRootOfTree) { if (pRootOfTree == nullptr)return nullptr; TreeNode* le = dfs(pR...
2023-03-15
0
190
题解 | #在二叉树中找到两个节点的最近公共祖先#
class Solution { public: int target; bool fl = false; int dfs(TreeNode* root, int p, int q) { if (root == nullptr)return 0; ...
2023-03-14
1
217
题解 | #二叉搜索树的最近公共祖先#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullpt...
2023-03-14
1
204
题解 | #判断是不是平衡二叉树#
class Solution { public: bool fl = true; int dfs(TreeNode* root) { if (root == nullptr)return 0; int le = dfs(root->left)...
2023-03-14
0
215
题解 | #判断是不是完全二叉树#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullpt...
2023-03-14
0
200
题解 | #判断是不是二叉搜索树#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullpt...
2023-03-14
0
225
题解 | #二叉树的镜像#
/** * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * TreeNode(int x) : val(x), left(nullptr), right(nullpt...
2023-03-14
0
208
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页