diff --git a/problems/0236.二叉树的最近公共祖先.md b/problems/0236.二叉树的最近公共祖先.md index bd312096..69127bd9 100644 --- a/problems/0236.二叉树的最近公共祖先.md +++ b/problems/0236.二叉树的最近公共祖先.md @@ -223,12 +223,10 @@ public: Java: - ```Java class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { return lowestCommonAncestor1(root, p, q); - } public TreeNode lowestCommonAncestor1(TreeNode root, TreeNode p, TreeNode q) { if (root == null || root == p || root == q) { @@ -247,6 +245,7 @@ class Solution { } ``` + ```java // 代码精简版 class Solution { @@ -261,6 +260,7 @@ class Solution { else return null; } } +``` Python: