Problem
Ask
Submissions

Problem: Univalued Binary Tree

Medium
30 min
Explore how to identify a univalued binary tree by checking if every node contains the same value. This lesson helps you implement a depth-first search method to solve this problem efficiently in Python, strengthening your skills in binary tree traversal and analysis.

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].

  • 00 \leq Node.data <100< 100

Problem
Ask
Submissions

Problem: Univalued Binary Tree

Medium
30 min
Explore how to identify a univalued binary tree by checking if every node contains the same value. This lesson helps you implement a depth-first search method to solve this problem efficiently in Python, strengthening your skills in binary tree traversal and analysis.

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].

  • 00 \leq Node.data <100< 100