Your question is Maximum Depth of Binary Tree. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
At Dropbox, a service stores hierarchical folder metadata as a binary tree. Given the root of a binary tree, return its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
root, the root node of a binary tree, or null for an empty tree.You should solve this as a standard binary tree traversal problem.
def max_depth(root):