Fade to Solo
Trees

Lowest Common Ancestor of a BST

30 MINMleetcode ↗

Problem

Given a binary search tree and two nodes p and q that exist in it, find their lowest common ancestor — the deepest node that has both as descendants (a node counts as its own descendant).

30 MIN00:00unlocks in 30:00
locked30:00 left