Available question text
Find the length of the longest path in a binary tree where adjacent node values differ by exactly 1 (either increasing or decreasing), and the path may go up through a parent and down to a child (i.e., can combine increasing and decreasing segments through a node). This requires tree traversal to compute, for each node, the longest increasing and decreasing consecutive runs in its subtrees and combine them to get the global maximum.
Related questions
Continue with questions that share topics or the same question type.
- Binary Tree Longest Consecutive Sequence
Coding
- Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree
Coding
- Longest Consecutive Sequence
Coding · Array · Hash Table · Union-Find
- Longest ZigZag Path in a Binary Tree
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 549. Binary Tree Longest Consecutive Sequence II
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source