Longest path of equal-valued tree nodes

0
Remix

Given a binary tree, return the length of the longest path in which every node has the same value. The path may pass through any node and need not include the root; agree with the interviewer whether length counts edges or nodes.

GoogleCodingLast asked Jun 2026
No answer yet. Write the first one; the best answer gets endorsed.