solulubeta
Sign in
NeetCode 150 / Trees
07.07 · Problem

Lowest Common Ancestor of a BST

Medium Walk down the BST until the values split 1 video LC 235 Pro

This problem is part of solulu Pro

Given a binary search tree and two of its nodes p and q, return their lowest common ancestor — the deepest node that has both p and q as descendants (a node counts as a descendant of itself). In the tests, p and q are…

Lifetime ₹1,999 ₹999 · Launch offer
Mark this problem as solved when you are finished.

Item 52 of 150 · updated 2026-10-12