0298. Binary Tree Longest Consecutive Sequence
Last updated
Last updated
https://leetcode.com/problems/binary-tree-longest-consecutive-sequence
Given the root
of a binary tree, return the length of the longest consecutive sequence path.
The path refers to any sequence of nodes from some starting node to any node in the tree along the parent-child connections. The longest consecutive path needs to be from parent to child (cannot be the reverse).
Example 1:
Example 2:
Constraints:
The number of nodes in the tree is in the range [1, 3 * 104]
.
-3 * 104 <= Node.val <= 3 * 104