public class Solution { public int nodeNum(TreeNode head) { if(head == null) { return 0 ; } return nodeNum(head.left) + nodeNum(head.right) + 1 ; } }