Longest Path of Equal Values in a Binary Tree

Asked at Snowflake · Coding Questions · Difficulty: Medium · Last asked Dec 23, 2025

Given a binary tree, find the longest path in which every node holds the same value. The path may start and end at any nodes and does not have to pass through the root. Its length is the number of edges on the path, not the number of nodes.

Loading the problem…