Meta·Software Engineer·Onsite - Coding / Algorithms
May 2026
Meta SWE coding round with two problems, one tree traversal question and one string manipulation question, each with a pile of follow-ups. The follow-ups are where things get interesting and probably where they're actually evaluating you.
- Given the root of a binary tree, group node values by vertical column using x-coordinates (left child decrements x, right child increments x). Within each column, nodes should appear top-to-bottom, with ties broken by left-to-right traversal order. Return a list of columns, each containing a list of integers. Walk through your algorithm, the data structures you'd use, and give a time and space complexity analysis.
- Follow-up to the binary tree column grouping: how would you stream results column by column without storing the entire traversal in memory first?
- Follow-up: if there are two nodes in the same row and column, how would you change the tie-breaking rule to sort by node value instead of traversal order?
- Follow-up: how does your approach scale to trees with up to 100,000 nodes? What breaks and what holds up?
- Given a string containing lowercase letters and parentheses, remove the minimum number of parentheses so the remaining string is balanced. Return any valid result. Provide an O(n) time solution and explain why it's correct.
- Follow-up: can you solve the balanced parentheses removal problem in a single pass?
- Follow-up: if in-place edits are allowed on the string, can you reduce extra space to O(1)?
“BFS with a hashmap from column index to list of values.” The rest of the author's notes on Software Engineer interview at Meta, Onsite - Coding / Algorithms round, covers how they worked through the question, what the panel pushed back on, and what they would do differently.
View Post