Python data engineering interview problem. Difficulty: advanced. Pattern: Trees. About 18 minutes. Part of the Pro drill bank.
Return level-order traversal as a list of levels. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement level_order(level_order_input: list) -> list returning [[level0], [level1], ...].
Input: level_order([3, 9, 20, None, None, 15, 7]) Output: [[3], [9, 20], [15, 7]] Three levels.
Topics: lakebench, python, bfs, levels.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Return level-order traversal as a list of levels.
Implement `level_order(level_order_input: list) -> list` returning `[[level0], [level1], ...]`. Example: `[3, 9, 20, None, None, 15, 7]` → `[[3], [9, 20], [15, 7]]`. Keep the harness.