标签:nbsp code bsp solution 身体 stc mon turn ret
身体不好
1 class Solution { 2 public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { 3 if(p.val < root.val && q.val < root.val) { 4 return lowestCommonAncestor(root.left, p , q); 5 }else if(p.val > root.val && q.val > root.val) { 6 return lowestCommonAncestor(root.right, p , q); 7 }else { 8 return root; 9 } 10 } 11 }
235. Lowest Common Ancestor of a Binary Search Tree
标签:nbsp code bsp solution 身体 stc mon turn ret
原文地址:https://www.cnblogs.com/goPanama/p/9575485.html