Standard Bar Binary Trees · Traversals O(n) · O(n)
A warranty clerk walks a dealership's branch chart loop-only: no recursive paperwork chains permitted. She parks nodes on her desk pile while sliding left, but a station may only be signed off once its right branch is either empty or already stamped — she keeps a seen-it ledger to tell the difference. If the right branch still needs work, it goes on the pile and the loop slides left through it first.
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 postorder, produced without recursion.
1 <= number of nodes <= 10^5-100 <= node value <= 100No recursive calls allowed — the traversal must run on an explicit stackInput: {"tree":[1,2,3,4,5,null,6]}
Output: [4,5,2,6,3,1]
Children always land before their parents; the root closes the log.
Input: {"tree":[7]}
Output: [7]
With no right branch pending, the lone node is stamped on the first peek.