package
1.6.6
Repository: https://github.com/awesee/leetcode.git
Documentation: pkg.go.dev

# README

< Previous                  Next >

250. Count Univalue Subtrees (Medium)

Given a binary tree, count the number of uni-value subtrees.

A Uni-value subtree means all nodes of the subtree have the same value.

Example :

Input:  root = [5,1,5,5,5,null,5]

              5
             / \
            1   5
           / \   \
          5   5   5

Output: 4

Related Topics

[Tree] [Depth-First Search] [Binary Tree]

Similar Questions

  1. Subtree of Another Tree (Easy)
  2. Longest Univalue Path (Medium)