Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 687. Longest Univalue Path
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.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Early October, 2025
Meta
Mid-level
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.