def tree_deep(root):
if not root:
return 0 #说明上一个节点是叶子节点,开始逐步返回
left, right = 0, 0
if root.left:
left = tree_deep(root.left) #左子树递归
if root.right:
right = tree_deep(root.right) #右子树递归
return max(left, right) + 1 #每一层能够运行到这说明该层有节点,所以深度+1