Solution: Univalued Binary Tree
Understand how to determine if every node in a binary tree has the same value using depth-first search. This lesson guides you through implementing a recursive C++ solution and analyzing its time and space complexity for both balanced and skewed trees.
We'll cover the following...
We'll cover the following...
Statement
A binary tree is considered uni-valued if every node in the tree contains the same value.
Given the root of a binary tree, return TRUE if the tree is uni-valued, or FALSE otherwise.
Constraints:
The number of nodes in the tree is in the range
. ...