This commit is contained in:
ehlxr 2022-06-20 10:13:43 +08:00
parent 23be3094f9
commit e754ded095

View File

@ -11,6 +11,7 @@ func find(root *TreeNode, l, r int) *TreeNode {
if root == nil { if root == nil {
return nil return nil
} }
// p 和 q 均存在于给定的二叉树中
if root.Val == l || root.Val == r { if root.Val == l || root.Val == r {
return root return root
} }