Implement prototype(tree: tuple | None) -> list[list[str]] and solve with the same signature. Input is None or a recursively nested (name: str, left, right) tuple. Names are unique and the structure is a tree without cycles or shared child nodes.
Return one list per depth, preserving left-to-right structural order. None returns []. Example: ('a', ('b', None, None), ('c', None, None)) returns [['a'], ['b', 'c']].
Prototype: rescan the tree for each depth. Final: process one queue frontier at a time in O(n) time and O(w) auxiliary space, excluding output. Do not modify the tree. No additional validation errors are required.
Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
Loading editor…
No results yet.
Complete the starter code, then run the checks.
Results and errors will appear here.