X321: Binary Tree Check Sum Exercise(Modified)

Given a binary tree, check if the tree satisfies the property that for each node, the sum of the values of its left and right children are equal to the node's value. If a node has only one child, then the node should have the same value as that child. Leaf nodes automatically satisfy the property.
Here are methods that you can use on the BinNode objects:
   interface BinNode {
      public int value();
      public void setValue(int v);
      public BinNode left();
      public BinNode right();
      public boolean isLeaf();
   }

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.