93. Maximum Depth of Binary Tree

EasyTree

Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Examples

Input: [3,9,20,null,null,15,7]

Output: 3

Explanation: The longest root-to-leaf path (3->20->15 or 3->20->7) has 3 nodes.

Constraints

  • The number of nodes in the tree is in the range [0, 10^4].
  • -100 <= Node.val <= 100
Loading...

Run checks all cases above. Submit evaluates all test cases.