Skip to content

Files

Latest commit

fb3e0f1 · Nov 5, 2019

History

History

problem008

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 5, 2019
Nov 5, 2019
Nov 5, 2019

Daily Coding Problem: Problem #8 [Easy]

Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

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