Search
⌘K

Leetcode 250. Count Univalue Subtrees

Given a binary tree, count how many subtrees are "univalue" (every node in the subtree has the same value). The core challenge is to determine for each node, via a bottom-up (postorder) traversal, whether its subtree is uniform without re-checking nodes, yielding an O(n) solution.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.