Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 521 Bytes

File metadata and controls

24 lines (17 loc) · 521 Bytes

Daily Coding Problem

Note: Continuous improvements and bug fixes are made within the repository to produce better solutions.

Day 8

A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value.

Given the root to a binary tree, count the number of unival subtrees.

For example, the following tree has 5 unival subtrees:

   0
  / \
 1   0
    / \
   1   0
  / \
 1   1

This problem was asked by Google.

Solution | Tests