Vertical order traversal

Write codeHard30 minMeta style

Your task

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.

Examples

vertical_order(arr: list[int]) -> list[list[int]]
Example 1
Inputvertical_order([3, 9, 20, None, None, 15, 7])
Output[[9], [3, 15], [20], [7]]