Tap here to switch tabs
Problem
Submissions

Problem: Univalued Binary Tree

Univalued Binary Tree asks whether every node in a given binary tree contains the same value, returning true if the entire tree is uni-valued and false otherwise.

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 [1,100][1, 100].

  • 0≤0 \leq Node.data <100< 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Univalued Binary Tree

Univalued Binary Tree asks whether every node in a given binary tree contains the same value, returning true if the entire tree is uni-valued and false otherwise.

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 [1,100][1, 100].

  • 0≤0 \leq Node.data <100< 100