Univalue Tree
Given a binary tree root
, return whether all values in the tree are the same.
Constraints
n ≤ 100,000
wheren
is the number of nodes inroot
https://binarysearch.com/problems/Univalue-Tree
Examples
Example 1
Input
- root =
Output
- answer =
False
Explanation
There is a node with a value 9
while others are 2
Example 2
Input
- root =
Output
- answer =
True
Explanation
Every node has the value 2
Leave a comment