Available question text
Given a binary tree, find the length (number of edges) of the longest path whose nodes all share the same value, where the path may lie anywhere in the tree. This is solved by a DFS that for each node computes the longest same-valued descending path into its children and combines left/right contributions to update the global maximum.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Meta
Leetcode 687. Longest Univalue Path
Reported Oct 3, 2025 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source