Longest Univalue Path

Preview

Given the root of the binary tree, find the longest path where all nodes along the path have the same value. This path doesn't have to include the root node. Return the number of edges on that path, not the number of nodes.

Sign in to read the full chapter.

Checking access…