Tap here to switch tabs
Problem
Submissions

Problem: Count Univalue Subtrees

Try to solve the Count Univalue Subtrees problem.

Statement

Given the root of a binary tree, return the total count of uni-value subtrees.

A uni-value subtree is a subtree where every node contains the exact same value.

Constraints:

  • The number of nodes in the tree is in the range [0,1000][0, 1000].

  • −1000≤-1000 \leq Node.val ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Univalue Subtrees

Try to solve the Count Univalue Subtrees problem.

Statement

Given the root of a binary tree, return the total count of uni-value subtrees.

A uni-value subtree is a subtree where every node contains the exact same value.

Constraints:

  • The number of nodes in the tree is in the range [0,1000][0, 1000].

  • −1000≤-1000 \leq Node.val ≤1000\leq 1000