Implement prototype(tree) and solve(tree). Input is null or a recursive array [name, left, right], with string names, no cycles, no shared children and unique names. Return one string array per depth, left-to-right. Null input returns [].
["a", ["b", null, null], ["c", null, null]] returns [["a"], ["b", "c"]]. Prototype: rescan per depth. Final: process one frontier at a time in O(n) time/O(w) auxiliary space, excluding output. Preserve all names and child links. No additional validation errors.
All numeric inputs and finite arithmetic results in this lesson are safe-integer Numbers. Use null for documented absence, not undefined or a numeric sentinel. Return actual booleans where the contract requires them. Do not add validation requirements beyond the documented inputs.
Run with Node.js 20+ from this directory:
node main.mjs --stage prototype
node main.mjs --stage finalEdit exercise.mjs; keep main.mjs unchanged. Both stages begin as unfinished learner functions. The website uses the same test functions in a separate browser worker. Tests check deterministic examples, boundaries, documented validation, input preservation, and stage-specific cases. Passing tests does not prove the required time complexity.
Complete the starter code, then run the checks.
Results and errors will appear here.