MEDIUMasked at 3 companies

Binary Tree Level Order Traversal II

A medium-tier problem at 66% community acceptance, tagged with Tree, Breadth-First Search, Binary Tree. Reported in interviews at Revolut and 2 others.

Founder's read

Binary Tree Level Order Traversal II shows up on Meta, Google, and Revolut assessments. It's a tree problem that looks straightforward until you realize the output format is the trick. You need to return levels bottom-up instead of top-down, which breaks the standard BFS pattern most candidates default to. The 66% acceptance rate means people are getting it wrong, usually by forgetting to reverse the result or mixing up the traversal order. If this problem hits your live OA and you blank on the reversal step, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
3
Difficulty
MEDIUM
Acceptance
66%

Companies that ask "Binary Tree Level Order Traversal II"

If this hits your live OA

Binary Tree Level Order Traversal II is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The trap here is that Binary Tree Level Order Traversal II looks identical to the standard level-order traversal until you read the output requirement. Most candidates code up a textbook BFS, collect levels in order, then panic because the problem wants them reversed. The pattern involves a queue and per-level collection, but you need to either reverse your final list or build it backwards from the start. Common failures: forgetting the reversal entirely, reversing individual levels instead of the level list, or trying to use a stack when BFS is already the right tool. The algorithmic complexity is straightforward, but the output format catches people mid-interview. StealthCoder is the hedge for the one candidate who nailed BFS on five other problems but blanks on this specific reversal detail.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Binary Tree Level Order Traversal II recycles across companies for a reason. It's medium-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Binary Tree Level Order Traversal II interview FAQ

Is this really a Medium, or is it easier?+

It's Medium because the reversal twist catches people off-guard even after they code a correct BFS. The underlying algorithm is standard breadth-first search, but the output requirement adds a gotcha that pushes acceptance down to 66%.

Do I have to reverse the entire list, or just the order I add levels?+

Either approach works. You can collect levels in order and reverse the final list at the end, or use a deque and prepend each level instead of appending. The first way is simpler and less error-prone in a live setting.

How does this relate to other tree traversal problems?+

This is breadth-first search applied to trees, so it shares the same queue-based structure as standard level-order traversal. The reversal is the only difference. If you've done classic BFS, you have 90% of the solution already.

Is this still asked at Meta and Google?+

Yes, it's in the assessment reports for both. Tree problems are foundational in their interview loops. If you see a tree problem, assume traversal variations like this one are fair game.

What's the most common mistake candidates make?+

Forgetting to reverse the result or reversing it incorrectly. Some candidates reverse each individual level instead of the list of levels, which breaks the output format. Others build the result correctly but never add the reversal step at all.

Want the actual problem statement? View "Binary Tree Level Order Traversal II" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.