mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 15:09:40 +08:00
@ -454,7 +454,11 @@ impl Solution {
|
||||
p: Option<Rc<RefCell<TreeNode>>>,
|
||||
q: Option<Rc<RefCell<TreeNode>>>,
|
||||
) -> Option<Rc<RefCell<TreeNode>>> {
|
||||
if root == p || root == q || root.is_none() {
|
||||
if root.is_none() {
|
||||
return root;
|
||||
}
|
||||
if Rc::ptr_eq(root.as_ref().unwrap(), p.as_ref().unwrap())
|
||||
|| Rc::ptr_eq(root.as_ref().unwrap(), q.as_ref().unwrap()) {
|
||||
return root;
|
||||
}
|
||||
let left = Self::lowest_common_ancestor(
|
||||
|
Reference in New Issue
Block a user