Skip to content

Commit 80b3f4a

Browse files
committed
Runtime: 47 ms (Top 42.80%) | Memory: 23.4 MB (Top 13.91%)
1 parent 2d901bc commit 80b3f4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// Runtime: 47 ms (Top 42.80%) | Memory: 23.4 MB (Top 13.91%)
12
class Solution {
23
public:
34
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
45
if(p->val<root->val && q->val<root->val) return lowestCommonAncestor(root->left,p,q);
56
else if(p->val>root->val && q->val>root->val) return lowestCommonAncestor(root->right,p,q);
67
return root;
78
}
8-
};
9+
};

0 commit comments

Comments
 (0)