Update 0236.二叉树的最近公共祖先.md
0236.二叉树的最近公共祖先 java版本中有一个变量没用,删除该变量
This commit is contained in:
parent
37d45290da
commit
adddd296c5
|
|
@ -249,7 +249,6 @@ class Solution {
|
|||
```java
|
||||
// 代码精简版
|
||||
class Solution {
|
||||
TreeNode pre;
|
||||
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
|
||||
if (root == null || root.val == p.val ||root.val == q.val) return root;
|
||||
TreeNode left = lowestCommonAncestor(root.left,p,q);
|
||||
|
|
|
|||
Loading…
Reference in New Issue