Given the root node of a binary tree, return the maximum depth of the tree. The maximum depth is defined as the length of the longest path from the root node to any leaf node, measured in number of nodes.
Example 1
Input: TreeNode(5, TreeNode(2), TreeNode(8, TreeNode(7), TreeNode(10)))
Output: 3
Explanation: Longest path: 5 -> 8 -> 10.
Example 2
Input: TreeNode(1, None, TreeNode(2, None, TreeNode(3)))
Output: 3
Explanation: Longest path: 1 -> 2 -> 3.
Constraints
Case 1
Input: TreeNode(4, TreeNode(3, TreeNode(2)), None)
Expected: 3
Case 2
Input: TreeNode(6, TreeNode(5, None, TreeNode(4)), TreeNode(7))
Expected: 3
Case 3
Input: None
Expected: 0
Case 4
Input: TreeNode(9)
Expected: 1