NeetCode #420LC-1650MediumTrees
← Back to All Problems

#420 · #1650 · Lowest Common Ancestor of a Binary Tree III(二叉树的最近公共祖先 III)

📌 Problem Statement & Constraints

Given two nodes p and q in a binary tree where each node has a parent pointer, return their lowest common ancestor. Constraints: the number of nodes is in [2, 10^5], all values are distinct.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!