Trains the technique from
LeetCode 314Binary Tree Vertical Order TraversalThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A control wall holds labelled junction panels hung in a binary arrangement. The topmost panel occupies column 0. Every panel may carry a lower-left panel and a lower-right panel: the lower-left one hangs one tier down and one column to the left, the lower-right one hangs one tier down and one column to the right.
The wall arrives as panels, a tier-by-tier listing. panels[0] is the top panel's label. The rest of the list is consumed two entries at a time, taking panels in the order they were listed: the next two entries are that panel's lower-left and lower-right labels, where null means no panel hangs there (and therefore contributes no entries of its own). Trailing nulls are omitted, and an empty list means the wall is bare.
Return the labels grouped by column, with the columns ordered from the leftmost to the rightmost. Inside a column, list the labels from the highest tier downwards, and when two panels share both a column and a tier, list the one hanging further left first.
Example 1
Panel 4 hangs in column -1, panel 7 in column 0 and panel 9 in column 1.
Example 2
Column -1 holds only panel 4. Column 0 holds panel 9 on tier 0 and panel 6 on tier 2. Column 1 holds panel 7 on tier 1 and panel 2 on tier 3.
Example 3
Panels 4 and 5 both land in column 0 on tier 2, and 4 hangs further left, so it is listed first.
Example 4
The wall is bare, so there are no columns to report.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def vertical_order(panels: list) -> list[list[int]]:public List<List<Integer>> verticalOrder(Integer[] panels)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.