CodeOath
← All problems

Maximum Depth of Binary Tree

Easy
trees

Given the root of a binary tree, return its maximum depth — the number of nodes along the longest path from the root down to the farthest leaf.

Trees in this problem are given as a level-order array: null marks a missing child, and trailing nulls are omitted.

Example:

Input: root = [3,9,20,null,null,15,7]
Output: 3