![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode刷题流水账
Truring
这个作者很懒,什么都没留下…
展开
-
leetcode590. N 叉树的后序遍历
题目链接https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/解题代码/*// Definition for a Node.class Node {public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; } Node(int _val,原创 2021-03-26 16:02:44 · 149 阅读 · 0 评论 -
leetcode589. N 叉树的前序遍历
题目链接https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/解题代码/*// Definition for a Node.class Node {public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; } Node(int _val, v原创 2021-03-26 15:56:18 · 157 阅读 · 0 评论 -
leetcode938. 二叉搜索树的范围和
题目链接https://leetcode-cn.com/problems/range-sum-of-bst/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * T原创 2021-03-26 13:59:58 · 176 阅读 · 0 评论 -
leetcode897. 递增顺序查找树
题目链接https://leetcode-cn.com/problems/increasing-order-search-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr)原创 2021-03-26 13:13:13 · 110 阅读 · 0 评论 -
leetcode872. 叶子相似的树
题目链接https://leetcode-cn.com/problems/leaf-similar-trees/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} *原创 2021-03-26 12:11:43 · 114 阅读 · 0 评论 -
leetcode671. 二叉树中第二小的节点
题目链接https://leetcode-cn.com/problems/second-minimum-node-in-a-binary-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right原创 2021-03-26 11:55:53 · 116 阅读 · 0 评论 -
leetcode572. 另一个树的子树
题目链接https://leetcode-cn.com/problems/subtree-of-another-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {}原创 2021-03-26 11:07:31 · 60 阅读 · 0 评论 -
剑指 Offer 55 - I. 二叉树的深度
题目链接https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {}原创 2021-03-25 19:14:48 · 101 阅读 · 0 评论 -
leetcode700. 二叉搜索树中的搜索
题目链接https://leetcode-cn.com/problems/search-in-a-binary-search-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullpt原创 2021-03-25 19:01:07 · 70 阅读 · 0 评论 -
leetcode965. 单值二叉树
题目链接https://leetcode-cn.com/problems/univalued-binary-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }原创 2021-03-25 17:06:37 · 67 阅读 · 0 评论 -
leetcode559. N 叉树的最大深度
链接https://leetcode-cn.com/problems/maximum-depth-of-n-ary-tree/解题代码/*// Definition for a Node.class Node {public: int val; vector<Node*> children; Node() {} Node(int _val) { val = _val; } Node(int _val, vector原创 2021-03-25 16:34:27 · 66 阅读 · 0 评论 -
leetcode617. 合并二叉树
链接https://leetcode-cn.com/problems/merge-two-binary-trees/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} *原创 2021-03-25 15:51:22 · 78 阅读 · 0 评论 -
leetcode501. 二叉搜索树中的众数
题目描述,链接https://leetcode-cn.com/problems/find-mode-in-binary-search-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nu原创 2021-03-25 13:56:33 · 79 阅读 · 0 评论 -
leetcode404. 左叶子之和
题目描述,链接https://leetcode-cn.com/problems/sum-of-left-leaves/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }原创 2021-03-25 13:20:06 · 78 阅读 · 0 评论 -
leetcode257. 二叉树的所有路径
题目描述,链接https://leetcode-cn.com/problems/binary-tree-paths/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} *原创 2021-03-25 12:31:20 · 74 阅读 · 0 评论 -
leetcode235. 二叉搜索树的最近公共祖先(剑指 Offer 68 - I. 二叉搜索树的最近公共祖先)
题目详情,链接https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-search-tree/解题代码/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), lef原创 2021-03-25 11:35:08 · 79 阅读 · 0 评论 -
leetcode 226. 翻转二叉树(剑指 Offer 27. 二叉树的镜像)
226. 翻转二叉树以下是实现代码,运用了递归函数,将问题拆分成一个个可以解决的小问题。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x)原创 2021-03-25 11:02:50 · 107 阅读 · 0 评论