Problem 687 · Medium

Longest Univalue Path

Find the longest path in a tree where every node on the path has the same value. The visual grows matching chains from each node and joins two chains at a top node.

Open the interactive visualisation