Datadog may represent nested event relationships as a binary tree for lightweight traversal tasks. Given the root of a binary tree, return its maximum depth, defined as the number of nodes on the longest path from the root to any leaf.
The input root is either null for an empty tree or a nested array of the form [value, left, right]. value is an integer, and left and right are either null or nested binary-tree arrays. Return an integer representing the tree's maximum depth.
Implement max_depth(root).
def max_depth(root):