LeetCode MEDIUM 236 Lowest Common Ancestor of a Binary Tree Summary
Generated by Codex with GPT-5
Difficulty: MEDIUM
Problem: Lowest Common Ancestor of a Binary Tree
Problem gist
Given the root of a binary tree and two existing nodes p and q, return their lowest common ancestor.
An ancestor can be the node itself. That detail matters: if p is above q, then p is the answer. “Lowest” means deepest in the tree, not smallest by value. This is a normal binary tree, so there is no useful ordering rule like there would be in a binary search tree.