Find Bottom Left Tree Value
Reported by candidates from Bloomberg's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Everything here hinges on a queue. Bloomberg reported this one in February 2021: find the leftmost value on the deepest level of a binary tree. It looks like a tree problem, but the real move is a level-order walk, so the queue is doing the work. If you've got an OA invite and 48 hours, this is a pattern you can lock in tonight. The logic is short, the edge cases are few, and the examples tell you exactly what the grader wants. StealthCoder sits invisibly on your screen as a safety net if your mind goes blank mid-assessment, but you should walk in already knowing the shape of the answer.
The problem
Given a nonempty binary tree, return the value of its leftmost node on the deepest level. Function findBottomLeftValue(root: TreeNode) → int Examples Example 1 root = [2,1,3] return = 1 The deepest level contains 1 and 3; 1 is leftmost. Example 2 root = [1,2,3,4,null,5,6,null,null,7] return = 7 Seven is the only node on the deepest level. Constraints The tree has between 1 and 10^5 nodes. Node values are 32-bit signed integers.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is breadth-first search. Push the root into a queue, process level by level, and record the first node you see on each level. When the queue empties, the last recorded value is your answer. Even simpler: enqueue the right child before the left, and the final node popped is the bottom-left value. No level counters needed. The DFS alternative tracks depth and updates the answer only when you reach a new max depth on a left-first traversal. The common pitfall is recursion depth. With up to 10^5 nodes, a skewed tree can blow the stack in some languages, so BFS is the safer pick. Another pitfall is returning the leftmost node overall instead of the leftmost on the deepest level. Example 2 catches that, since 7 is the answer, not 4. If you freeze during the live OA, StealthCoder can hand you the BFS skeleton so you just verify it against the examples.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Find Bottom Left Tree Value 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. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as find bottom left tree value. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Bloomberg's OA.
Bloomberg reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Find Bottom Left Tree Value FAQ
How hard is Find Bottom Left Tree Value really?+
It's easy to medium. If you know level-order traversal, it's about ten lines. The Bloomberg version from February 2021 has no twist beyond the standard problem, so the main risk is overthinking it or fumbling null handling.
What's the trick to solve it fast?+
Use BFS with a queue and enqueue right child first, then left. The last node you pop is the bottom-left value. No level tracking, no depth variable. It works because the final node processed sits on the deepest level, and left goes last.
Should I use DFS or BFS?+
BFS is safer. With up to 10^5 nodes, a skewed tree can cause deep recursion and a stack overflow in some languages. DFS works if you track depth and only update on strictly deeper levels, visiting left before right.
What edge cases should I test?+
Test a single-node tree, a tree where the deepest level has one node on the right side, and a left-skewed or right-skewed chain. Example 2 is the key one: the answer 7 is not the leftmost node overall. Node values can be negative, so don't use zero as a sentinel.
How do I prepare in 48 hours for tree questions like this?+
Write BFS level-order and recursive DFS from memory a few times. Then do a handful of tree problems that use depth, like max depth and right side view. Focus on recognizing when a queue beats recursion. That covers most tree OAs.