X295: Binary Tree Increment By One Exercise

Write a recursive function that increments by one the value for every node in the binary tree pointed at by root, then returns the modified tree. Assume that nodes store integer values.
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.