package GeeksforGeeksPractice;

public class _0017CheckSumTree {
	public static class TreeNode {
		int val;
		TreeNode left;
		TreeNode right;
		TreeNode(int x) { val = x; }
	}
	public static void main(String args[]){
		TreeNode tn=new TreeNode(10);
		tn.left=new TreeNode(8);
		tn.right=new TreeNode(2);
		tn.left.left=new TreeNode(3);
		tn.left.right=new TreeNode(5);
		tn.right.left=new TreeNode(1);
		tn.right.right=new TreeNode(1);
		System.out.println(checkSumTree(tn));
	}
	public static boolean checkSumTree(TreeNode tn) {
		
		return true;
	}

}

@@ -252,10 +252,10 @@
 ode(
-10
+26
 );%0D%0A
@@ -281,9 +281,10 @@
 ode(
-8
+10
 );%0D%0A
@@ -307,17 +307,17 @@
 reeNode(
-2
+3
 );%0D%0A%09%09tn
@@ -332,33 +332,33 @@
 ft=new TreeNode(
-3
+6
 );%0D%0A%09%09tn.left.ri
@@ -378,9 +378,9 @@
 ode(
-5
+4
 );%0D%0A
@@ -439,25 +439,25 @@
 ew TreeNode(
-1
+2
 );%0D%0A%09%09System
@@ -551,23 +551,366 @@
 %0D%0A%09%09
-%0D%0A%09%09return true
+if(tn!=null)%0D%0A%09%09%7B%09%0D%0A%09%09%09if(tn.left==null && tn.right==null)%0D%0A%09%09%09%09return true;%0D%0A%09%09%09if (tn.val==(sum(tn.left)+sum(tn.right)) && checkSumTree(tn.left) && checkSumTree(tn.right))%0D%0A%09%09%09%09return true;%0D%0A%09%09%09return false;%0D%0A%09%09%7D%0D%0A%09%09return true;%0D%0A%09%7D%0D%0A%09private static int sum(TreeNode tn) %7B%0D%0A%09%09if(tn!=null)%0D%0A%09%09%7B%0D%0A%09%09%09return tn.val+sum(tn.left)+sum(tn.right);%0D%0A%09%09%7D%0D%0A%09%09return 0
 ;%0D%0A%09

Check sum tree redo completed