mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-11 13:00:22 +08:00
Update 0236.二叉树的最近公共祖先.md
0236.二叉树的最近公共祖先 java版本中有一个变量没用,删除该变量
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user