一棵二叉树上的叶子节点数
def getLeaveNodes(self, root, count): if root is None: return 0 if root.left is None and root.right is None: count += 1 return count left_count = self.getLeaveNodes(root.left, count) right_count = self.getLeaveNodes(root.right, count) return left_count + right_count