private int countUnivalSubtreesUtil(Node root, int val) {
        if (root == null) {
            return val;
        }
        int left = countUnivalSubtreesUtil(root.left, root.data);
        int right = countUnivalSubtreesUtil(root.right, root.data);
        if (left == right && left == root.data) {
            count++;
            return root.data;
        } else {
            return Integer.MAX_VALUE;
        }
    }
Date 10/07/2016
@author Tushar Roy

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.

https://leetcode.com/problems/count-univalue-subtrees/
src/com/interview/tree/CountUnivalueTree.java