From ee0e80dae79071d1b48dfcc022e33f827de9c532 Mon Sep 17 00:00:00 2001 From: Luo <82520819+Jerry-306@users.noreply.github.com> Date: Mon, 28 Feb 2022 14:18:29 +0800 Subject: [PATCH] =?UTF-8?q?0700=20=E4=BA=8C=E5=8F=89=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=A0=91=20=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E6=9B=B4?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结果没问题,但逻辑不严谨 --- problems/0700.二叉搜索树中的搜索.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/problems/0700.二叉搜索树中的搜索.md b/problems/0700.二叉搜索树中的搜索.md index 1521514a..fd1d21ac 100644 --- a/problems/0700.二叉搜索树中的搜索.md +++ b/problems/0700.二叉搜索树中的搜索.md @@ -200,7 +200,7 @@ class Solution { if (val < root.val) root = root.left; else if (val > root.val) root = root.right; else return root; - return root; + return null; } } ``` @@ -236,7 +236,7 @@ class Solution: if val < root.val: root = root.left elif val > root.val: root = root.right else: return root - return root + return None ``` @@ -271,7 +271,7 @@ func searchBST(root *TreeNode, val int) *TreeNode { break } } - return root + return nil } ``` @@ -301,7 +301,6 @@ var searchBST = function (root, val) { return searchBST(root.left, val); if (root.val < val) return searchBST(root.right, val); - return null; }; ``` @@ -330,7 +329,7 @@ var searchBST = function (root, val) { else return root; } - return root; + return null; }; ```