Computing the Maximum Depth of a Binary Tree
Givan a binary tree, the maximum depth is the number of nodes along the longest root‑to‑leaf path. Leaf nodes are those with no children. Depth‑First Search (Recursive) The recursive approach computes the depth of the left and right subtreees, then takes the maximum plus one. class TreeNode: def __i...