Pattern 22: LeetCode Interview Patterns24 sections · 736 units
Open in CourseQuiz: LCA in BST
Test your understanding
Check Your Understanding
In a BST, if p = 2 and q = 8, and the current node is 6, what should you do?
- A.Return 6 as the LCA because p and q are on opposite sides
- B.Go right because 8 > 6
- C.Go left because 2 < 6
- D.Check both subtrees recursively