title: How do I remove the leaves of a binary tree?
body: <p>I'm trying to remove all of the leaves. I know that leaves have no children, this is what I have so far.</p>
  
  <pre><code> public void removeLeaves(BinaryTree n){  
  
      if (n.left == null &amp;&amp; n.right == null){
  
          n = null;
  
      }
  
      if (n.left != null)
  
          removeLeaves(n.left);
  
      if (n.right != null)
  
          removeLeaves(n.right);
  
  }
  </code></pre>