https://leetcode.com/problems/univalued-binary-tree
A binary tree is uni-valued if every node in the tree has the same value.
Given the root of a binary tree, return true if the given tree is uni-valued, or false otherwise.
root
true
false
Example 1:
Example 2:
Constraints:
The number of nodes in the tree is in the range [1, 100].
[1, 100]
0 <= Node.val < 100
Last updated 4 years ago
**Input:** root = [1,1,1,1,1,null,1] **Output:** true
**Input:** root = [2,2,2,5,2] **Output:** false