Code RoomVertical order traversal
HardPrep Room Coding #108

Vertical order traversal

CodingAlgorithms & data structuresSenior–Staff~30 min

Given a binary tree as a level-order array `arr` (null for missing), return its vertical order traversal. Assign the root column 0; a left child is column-1 and a right child is column+1. Output columns left to right; within a column, order nodes by row (depth) top to bottom, and when two nodes share the same row and column, order them by ascending value. Return a list of lists of values. `0 <= node count <= 1000`.

Implement
vertical_order(arr: list[int]) → list[list[int]]
Examples
in[[3,9,20,null,null,15,7]]out[[9],[3,15],[20],[7]]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 30 min
InputExpectedGot
[[3,9,20,null,null,15,7]][[9],[3,15],[20],[7]]not run yetsample