This question evaluates a candidate's ability to design and analyze efficient tree algorithms and data structures, focusing on tree traversal, diameter-related reasoning, and meeting specified complexity bounds (O(n) time, O(h) space).

Given a binary tree, define alive nodes. Base case: alive nodes are the leaves. Find the maximum distance (number of edges) between any two alive nodes; this is the tree diameter when alive nodes are leaves. Provide an O(n) time, O(h) space algorithm. Follow-ups: (