Advertisement
Guest User

nonLeaves

a guest
Dec 8th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.15 KB | None | 0 0
  1. if(root == null)
  2. return 0;
  3.  
  4. if(root.left != null || root.right != null)
  5. return 1;
  6.  
  7. return nonLeaves(root.left) + nonLeaves(root.right);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement