Hey y’all, I’ve been trying to wrap up the remaining key problems that Meta asks, so today I got a solution for a top 3 tagged question: Leetcode 987 Vertical Order Traversal of a Binary Tree.
Yes, I know that Leetcode 314 is technically the 3rd most asked one (according to Leetcode) and that used to be true up until 2 months or so ago…Meta’s been asking the Hard version instead, which sucks.
There’s a fair chance you get asked one of two variants but even if you do, it’ll only change at most 5 lines of code in your implementation. Understanding the OG leetcode problem is important, so for the second time ever, I suggest watching the whole video.
As for the variants…
- What if you had to print out the vertical order traversal?
Here, please ask your interviewer about formatting requirements before jumping into the code. - What if you had to return the vertical order traversal as a
List?
Check it out (or not!):
Leetcode 987 Vertical Order Traversal of a Binary Tree

Reference to the OG LC problem: https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/description/
Good luck on your phone screens & onsite loops.


