Problem 549 · Medium

Binary Tree Longest Consecutive Sequence II

Given the root of a binary tree, return the length of the longest consecutive path, where the path may be increasing or decreasing and may travel child -> parent -> child.

Open the interactive visualisation