Baseline Binary Trees · Traversals O(n) · O(n)
An airport's terminal is split into two concourses joined at a central hub. The inspection team's protocol is strict: clear every gate in the left concourse before stamping the hub checkpoint, then sweep the right concourse. Inside any concourse the same protocol repeats recursively. The stamped order of checkpoints is the sweep's official record.
Input: The root of a binary tree given as a level-order array where null marks a missing child.
Output: Return an array of node values in inorder: visit the left subtree, then the node, then the right subtree.
1 <= number of nodes <= 10^5-100 <= node value <= 100Input: {"tree":[1,2,3,4,5,null,6]}
Output: [4,2,5,1,3,6]
Left subtree {4,2,5} yields 4,2,5; then root 1; then right subtree {3,6}.
Input: {"tree":[7]}
Output: [7]
With no children, the single node is recorded in its own turn.