Tap here to switch tabs
Problem
Submissions

Problem: Binary Tree Longest Consecutive Sequence

Try to solve the Binary Tree Longest Consecutive Sequence problem.

Statement

Given the root of a binary tree, return the length of the longest consecutive sequence path.

A consecutive sequence path is a path where each node value increases by 11 along the path from parent to child. The path must only travel from parent to child and cannot move upward.

Constraints:

  • The number of nodes in the tree is in the range [1,3imes104][1, 3 imes 10^4].

  • −3imes104≤-3 imes 10^4 \leq Node.val ≤3imes104\leq 3 imes 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Binary Tree Longest Consecutive Sequence

Try to solve the Binary Tree Longest Consecutive Sequence problem.

Statement

Given the root of a binary tree, return the length of the longest consecutive sequence path.

A consecutive sequence path is a path where each node value increases by 11 along the path from parent to child. The path must only travel from parent to child and cannot move upward.

Constraints:

  • The number of nodes in the tree is in the range [1,3imes104][1, 3 imes 10^4].

  • −3imes104≤-3 imes 10^4 \leq Node.val ≤3imes104\leq 3 imes 10^4