title: Confirm code that returns nodes with two children
body: <p>I was given the following code that is supposed to determine the number of nodes in a tree that have two children...</p>
  
  <pre><code>public int twoChildren(TreeNode&lt;Integer&gt; root){
      int counter= 0;
      if (root == null)
          return 0;
      else if (root.right != null &amp;&amp; root.left != null)
          counter++;
  
      int leftTwoChildren = twoChildren(root.left);
      int rightTwoChildren = twoChildren(root.right);
  
      return counter + leftTwoChildren + rightTwoChildren;
  }
  </code></pre>
  
  <p>My job is to identify if this code is doing that, and if it isn't then figure out what the issue is. It all seems to check out with me, but I just wanted to double check that the counter works on this example. Would I even need the two integers for the left and right? I'm not sure. If someone could confirm this checks out or let me know there's an issue I would greatly appreciate it.</p>