旺旺汪汪大旺财
旺旺汪汪大旺财
全部文章
分类
题解(47)
归档
标签
去牛客网
登录
/
注册
旺旺汪汪大旺财的博客
全部文章
(共43篇)
题解 | #在二叉树中找到两个节点的最近公共祖先#
如果该节点不是O1也不是O2,那么O1与O2必然分别在该节点的左子树和右子树中 如果该节点就是O1或者O2,那么另一个节点在它的左子树或右子树中 稍微可以优化的一点就是,遇到O1或者O2节点就不往下递归了,把O1或者O2节点一层层往上传 /* * public class TreeNode {...
Java
2022-03-21
0
346
题解 | #二叉搜索树的最近公共祖先#
/* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * public TreeNode(int val) { * this.val...
Java
2022-03-21
0
334
题解 | #判断是不是平衡二叉树#
public boolean IsBalanced_Solution(TreeNode root) { return getDepth(root)!=-1; } private int getDepth(TreeNode root){ if(root=...
Java
2022-03-21
0
254
题解 | #判断是不是完全二叉树#
/* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * public TreeNode(int val) { * this.val...
Java
2022-03-21
0
332
题解 | #判断是不是二叉搜索树#
/* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * public TreeNode(int val) { * this.val...
Java
2022-03-21
0
314
题解 | #二叉树的镜像#
/* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * public TreeNode(int val) { * this.val...
Java
2022-03-20
0
218
题解 | #合并二叉树#
/* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * } */ public class Solution { /** ...
Java
2022-03-20
0
229
题解 | #对称的二叉树#
public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; ...
Java
2022-03-20
0
267
题解 | #二叉搜索树与双向链表#
public class TreeNode { int val = 0; TreeNode left = null; TreeNode right = null; public TreeNode(int val) { this.val = val; ...
Java
2022-03-20
0
236
题解 | #二叉树中和为某一值的路径(一)#
递归 /* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * } */ public class Solution { /** ...
Java
2022-03-16
0
261
首页
上一页
1
2
3
4
5
下一页
末页