Trees and DFS: Given a binary tree in heap-indexed level-order form (children of index i are 2i+1 and 2i+2; null means no node), return its maximum node depth.
Input: A JSON object { "tree": (number | null)[] }.
Output: A JSON integer; an empty tree or null root has depth 0.
Constraints:
- 0 <= tree.length <= 100000
- Only non-null entries represent nodes
- Depth counts nodes on the longest root-to-leaf path
Read one JSON value from stdin and print exactly one JSON-serialized answer to stdout with no extra text.
Difficulty: EASY. Variant: 4. Balance correctness, maintainability, and clear review-ready code.
Practice context
This coding (algo) exercise trains prompt interpretation, explicit assumptions, a concrete response, and a concise explanation of the decisions made. It is marked easy difficulty.
The signed-in workspace provides the tools required by the round, such as rec