public static int SumTree(SumTheTreeNode root) { if (root == null) { return(0); } int sum = root.Value; sum += SumTree(root.Left); sum += SumTree(root.Right); return(sum); }
public SumTheTreeNode(int value, SumTheTreeNode left = null, SumTheTreeNode right = null) { Value = value; Left = left; Right = right; }
public int Test(SumTheTreeNode root) => Kata.SumTree(root);