Reported February 2026
Bloombergbreadth first search

Binary Tree Vertical Order Traversal

Reported by candidates from Bloomberg's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Bloomberg OA. Under 2s to a working solution.
Founder's read

The edge case that sinks most first attempts at this Bloomberg question is the empty tree, and right behind it is the tie when two nodes land on the same row and column. Bloomberg reported this one in February 2026. It's Binary Tree Vertical Order Traversal, and the pattern is a breadth-first walk that tags every node with a column number. The idea is simple. The ordering rules are where people slip. If you blank on the details during the live OA, StealthCoder runs invisibly as a safety net and reads the problem for you. Know the trick first, though.

The problem

Given the root of a binary tree, return its vertical order traversal.
Place the root in column 0. A left child is one column to the left of its parent, and a right child is one column to the right. Return the columns from leftmost to rightmost.
Within each column, list nodes from top to bottom. If two nodes have the same row and column, preserve their left-to-right breadth-first encounter order.

Function
verticalOrder(root: TreeNode) → int[][]

Examples
Example 1
root = [3,9,20,null,null,15,7]
return = [[9],[3,15],[20],[7]]
The occupied columns are -1, 0, 1, and 2. Nodes 3 and 15 share column 0 and appear from top to bottom.
Example 2
root = [1,2,3,4,5,6,7]
return = [[4],[2],[1,5,6],[3],[7]]
Nodes 5 and 6 have the same row and column. Breadth-first left-to-right order places 5 before 6.
Example 3
root = []
return = []
An empty tree has no columns.

Constraints
The tree contains at most 1000 nodes.
-1000 <= Node.val <= 1000.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is BFS with a queue of (node, column) pairs. Pop a node, append its value to a hash map keyed by column, then push the left child with column minus 1 and the right child with column plus 1. BFS gives you top-to-bottom order for free, and it also handles the tie rule, because 5 comes before 6 when they share a row and column. Track the min and max column as you go, then read the map from min to max. No sort needed. The common pitfall is using DFS, which breaks the top-to-bottom order unless you also store the row and sort. The other pitfall is forgetting the empty root, which must return an empty list. With up to 1000 nodes, O(n) is easily fast enough. If your head goes blank mid-assessment, StealthCoder is the hedge that can hand you this structure live.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Binary Tree Vertical Order Traversal cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as binary tree vertical order traversal. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Bloomberg's OA.

Bloomberg reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Binary Tree Vertical Order Traversal FAQ

What's the trick in Bloomberg's Binary Tree Vertical Order Traversal?+

Use BFS with a queue holding each node and its column. Store values in a map from column to list. Root is column 0, left is minus 1, right is plus 1. BFS naturally gives top-to-bottom and left-to-right tie order, so you don't need any sorting.

Why does DFS fail here?+

DFS can visit a deeper node in a column before a shallower one, so the top-to-bottom order breaks. You'd need to store rows and sort, which adds work and risks getting the same-row tie order wrong. BFS avoids all of that.

How do I return columns from leftmost to rightmost without sorting?+

Track the minimum and maximum column seen while traversing. After BFS finishes, loop from min to max and pull each column's list from the map. That's linear and avoids sorting the keys.

What edge cases should I test before submitting?+

Test the empty tree, which returns an empty list. Test a single node. Test a skewed tree that only goes left or only right. Test Example 2, where nodes 5 and 6 share a row and column and 5 must come first.

How do I prepare for this in 48 hours?+

Write the BFS version from scratch twice, until the queue of node and column pairs is automatic. Then run the three examples by hand. This is a tree traversal with a small twist, so one clean solid pass beats grinding ten variants.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Bloomberg.

OA at Bloomberg?
Invisible during screen share
Get it