298. Binary Tree Longest Consecutive Sequence

Problem

Find the length of the longest consecutive sequence path in a binary tree (parent to child direction only).

Given the root of a nonempty binary tree, find the length of the longest consecutive sequence path. A path may start at any node, follows parent-to-child edges only, and each child value is exactly one more than its parent value (for example, 1→2→3).

Examples
Input: [1,2,null,3]
Output: 3
Hints

298. Binary Tree Longest Consecutive Sequence

Find the length of the longest consecutive sequence path in a binary tree (parent to child direction only).