NeetCode #400LC-298MediumTreesNC Algo100
← Back to All Problems

#400 · #298 · Binary Tree Longest Consecutive Sequence(二叉树最长连续序列)

📌 Problem Statement & Constraints

Given the root of a binary tree, find the length of the longest consecutive path: a path where each node's value is exactly one greater than its parent's. The path must follow parent-child links and may go only downward. Constraints: the number of nodes is in [1, 3 * 10^4].
🔒

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!