Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.