From 1e6265d6791b64b26029ffc6a2100c66f0c4c20f Mon Sep 17 00:00:00 2001 From: "xeniaxie(xl)" Date: Sun, 27 Jun 2021 10:35:03 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"0235=E4=BA=8C=E5=8F=89=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A0=91=E7=9A=84=E6=9C=80=E8=BF=91=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E7=A5=96=E5=85=88"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit c0dbcc8a73eec6517b8b26e376a8c7060b8b858b. --- ...35.二叉搜索树的最近公共祖先.md | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/problems/0235.二叉搜索树的最近公共祖先.md b/problems/0235.二叉搜索树的最近公共祖先.md index b8b23f09..d78db42a 100644 --- a/problems/0235.二叉搜索树的最近公共祖先.md +++ b/problems/0235.二叉搜索树的最近公共祖先.md @@ -312,46 +312,7 @@ func lowestCommonAncestor(root, p, q *TreeNode) *TreeNode { }else {return findLeft} } ``` -JavaScript版本: -1. 使用递归的方法: -```javascript -var lowestCommonAncestor = function(root, p, q) { - // 使用递归的方法 - // 1. 使用给定的递归函数lowestCommonAncestor - // 2. 确定递归终止条件 - if(root === null) { - return root; - } - if(root.val>p.val&&root.val>q.val) { - // 向左子树查询 - let left = lowestCommonAncestor(root.left,p,q); - return left !== null&&left; - } - if(root.valp.val&&root.val>q.val) { - root = root.left; - }else if(root.val