Code Room
CodingHardcod-g051
Subject Binary treesLevel Senior–Staff~30 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.