package leetcode;

/**
 * https://leetcode.com/problems/univalued-binary-tree/
 */
public class Problem965 {
    public static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode(int x) {
            val = x;
        }
    }

    public boolean isUnivalTree(TreeNode root) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem965 prob = new Problem965();
    }
}

@@ -327,36 +327,43 @@
     
-// TODO%0A        return false
+return isUnivalTree(root, root.val)
 ;%0A  
@@ -372,29 +372,30 @@
 %7D%0A%0A    p
-ublic
+rivate
  static 
 void mai
@@ -390,76 +390,260 @@
 tic 
-void main(String%5B%5D args) %7B%0A        Problem965 prob = new Problem965(
+boolean isUnivalTree(TreeNode node, int val) %7B%0A        if (node == null) %7B%0A            return true;%0A        %7D%0A        if (node.val != val) %7B%0A            return false;%0A        %7D%0A        return isUnivalTree(node.left, val) && isUnivalTree(node.right, val
 );%0A 

Solve problem 965