counting number of leaf nodes in binary tree
问题 I want to count the no of leaf nodes: Note:Cannot use global/class level variable I implmeted following algo, and it works fine.But i want method signature to be countLeaves(Node node) I know that i can overload methds and call the 2 args method sig from 1 args, but dont want to do so.Can anyone suggest any other method? int countLeaves(Node node,int count){ if(node==null) return 0; if(node.left==null && node.right==null){ return 1+count; }else{ int lc = countLeaves(node.left, count); int