"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""classSolution:""" @param root: The root of binary tree. @return: An integer """defmaxDepth(self,root):# write your code hereifroot==None:return0ifroot.left!=None:left=self.maxDepth(root.left)else:left=0ifroot.right!=None:right=self.maxDepth(root.right)else:right=0returnmax(left,right)+1