LC 102
LeetCode 102 · Medium

Binary Tree Level Order Traversal

Return node values grouped by tree level, top to bottom.

BFS → · High frequency · Solve on LeetCode →

Try it

Step through the core mechanic. The simulator below runs the bfs shape this problem is built on.

Walk the pattern

No dedicated step-through for this one yet. The shape is BFS — its pattern page has the interactive walkthrough, the reference implementation, and a five-problem progression that this problem sits inside.

The approach

BFS with a queue; at each step record the current queue size and pop exactly that many to bound one level, enqueuing children for the next. Each level becomes one output list.

AspectValue
PatternBFS
Recognise it byVisit nodes level by level.
Time complexityO(n)
Space complexityO(n)
DifficultyMedium

Who asks it

Companies known to ask this problem, from public LeetCode company-tag aggregations. A signal of where to expect it, not a guarantee.