Interview Questions230 real reports analyzed

Meta Interview Questions

The questions Meta actually asks — distilled from 230 real candidate reports and ranked by how often they came up. Coding, system design, and behavioral, with model answers written by our team.

127

questions tracked

87

coding problems

230

reports analyzed

Updated 2026-05-26

Most-asked Meta questions

The questions reported most often across real Meta interviews, each with a model answer written by our team.

Check if a string matches a given abbreviation pattern where digits represent consecutive character counts.

asked in 18 reportsmediumO(n + m) time where n = len(string) and m = len(pattern); O(1) space

Use two pointers to traverse the pattern and string simultaneously. For each pattern element: if it's a digit, parse the complete number (including multi-digit cases) and advance the string pointer by that count; if it's a letter, verify it matches the current string character. Edge case: leading zeros are invalid. The key insight is that the pattern fully describes the string structure—digits represent skipped character sequences, not wildcards. Both pointers must reach their ends simultaneously for a valid match.

Implement weighted random selection to pick an index based on probability weights.

asked in 16 reportsmediumO(n) preprocessing, O(log n) per selection; O(n) space

Build a cumulative weight array where each index stores the sum of weights up to that point. To select: generate a random number in [0, total_weight), then binary search the cumulative array to find the first index where cumulative_weight ≥ random_value. This transforms O(n) linear scanning into O(log n) queries after O(n) preprocessing. The key insight is that cumulative weights map the weight distribution to a continuous range we can search efficiently.

Discuss your approach to handling conflict in a team.

asked in 14 reports

I view conflict as incomplete context, not interpersonal failure. First, I listen actively to understand the underlying concern—not just the position. Then I reframe around what Meta values: our mission and shared impact. For technical disagreements, I bring data; for process friction, I address it directly and privately before escalating. I'm comfortable with disagreement itself; Meta rewards people who can advocate strongly then commit fully to the group decision. The key: separate the person from the problem, stay mission-focused, and resolve at the lowest level possible.

Calculate the sum of nested integers where each integer's contribution is weighted by its nesting depth.

asked in 14 reportsmediumO(N) time, O(D) space where N = total elements, D = max nesting depth

Use DFS traversal, tracking the current depth as you progress. When encountering an integer, add value × depth to the sum. For nested lists, recurse with depth + 1. The key insight: depth naturally increments during traversal, automatically weighting each contribution by nesting level. An iterative stack-based solution avoids recursion limits and handles arbitrarily deep nesting efficiently.

Perform a vertical order traversal of a binary tree.

asked in 13 reportsmediumO(n) time, O(n) space

Use BFS with column indexing: assign root column 0, left child = parent−1, right child = parent+1. Store nodes in a map keyed by column. Process the tree level-by-level via BFS (preserving natural top-to-bottom order within columns), then return columns in sorted order. Key insight: BFS naturally maintains level order, eliminating explicit level tracking.

Find the minimum number of characters to remove to make a string of parentheses valid.

asked in 13 reportsmediumO(n) time, O(1) space

Use a single-pass greedy approach: track unmatched opening parentheses with a counter. For each '(', increment it; for each ')', decrement if counter > 0 (matched), otherwise count as a removal. At the end, any remaining unmatched '(' must also be removed. The key insight is that we need only counters, not storage—every '(' without a matching ')' and every ')' without a preceding '(' must be removed.

Merge overlapping intervals into non-overlapping ones.

asked in 13 reportsmediumO(n log n) time, O(1) space

Sort intervals by start time. Iterate through maintaining the current merged interval—when next interval's start ≤ current end, extend the end. Otherwise, save the current interval and start fresh. The key insight: sorting guarantees no merges are missed, since overlapping intervals must be processed consecutively. Greedy merging is optimal because once sorted, each interval either overlaps the previous or stands alone.

Given a directory path and a cd command, return the resulting current directory path.

asked in 12 reportsmediumO(n) time, O(n) space

If the cd command starts with /, treat it as absolute—start from root; otherwise, append it to the current directory. Then normalize by splitting on / and using a stack: push each non-empty directory name, skip . (current), and pop for .. (parent, if stack non-empty). Join the stack with / and prepend /. This stack-based approach elegantly handles all cases: redundant slashes, chains of .., and the boundary condition at the filesystem root.

Find the shortest path in a binary matrix with obstacles.

asked in 11 reportsmediumO(m·n) time, O(m·n) space

Use BFS to find the shortest path in this unweighted graph. Start from (0,0), maintain a queue of cells with their distances. For each cell, explore all 4 neighbors—add them to the queue only if they're in bounds, not obstacles (value 0), and haven't been visited. Mark cells as visited to prevent revisiting. Return the distance when reaching (m-1, n-1), or -1 if unreachable. BFS naturally explores level-by-level, guaranteeing the first path found is shortest.

Sum values in a binary search tree that fall within a specified range.

asked in 11 reportsmediumO(n) worst case, O(h + k) best case; O(h) space

Use DFS with pruning: if node value < low, skip left subtree and go right; if > high, skip right subtree and go left; otherwise add value and explore both subtrees. This exploits BST ordering to prune branches outside the range. Time complexity depends on tree balance and range size: best case O(h + k), worst case O(n) when all nodes fall within range.

Implement a calculator that evaluates arithmetic expressions with proper operator precedence.

asked in 11 reportsmediumO(n) time, O(n) space

Use a single-pass stack-based approach: parse tokens left-to-right, immediately applying multiplication and division (higher precedence) to the top of the stack, while deferring addition and subtraction. When you encounter a lower-precedence operator, resolve any pending higher-precedence operations first. Maintain a stack of accumulated values and sum them at the end. This naturally respects precedence rules without building an expression tree.

Merge three sorted arrays into a single sorted array.

asked in 10 reportsmediumO(n) time, O(n) space

Use three pointers (one per array) to track your position in each. At each step, compare the current elements from all three arrays and append the smallest to the result, advancing that array's pointer. When an array is exhausted, continue merging the remaining two. This greedy approach processes each element exactly once, making it optimal.

Find the lowest common ancestor of two nodes in a tree given only parent pointers.

asked in 10 reportsmediumO(h) time, O(1) space

Traverse both nodes to the root while tracking their depths. Move the deeper node up until both reach the same depth, then advance both upward simultaneously until they meet. This works because once both nodes are equidistant from the root, they'll reach their common ancestor in the same number of steps. The LCA is where both paths converge.

Given a string, determine if it is a valid palindrome allowing at most one character deletion.

asked in 10 reportsmediumO(n) time, O(1) space

Use a two-pointer approach from both ends. When characters match, move inward. On the first mismatch, the key insight is you only need to try two deletions: remove the left character and check if the remaining substring is a palindrome, OR remove the right character and check. If either succeeds, return true. This works because once you find a mismatch, you must use your one deletion there or the strings can't match. A helper function validates if a substring is palindromic by comparing characters inward.

Find the kth largest element in an array.

asked in 9 reportsmediumO(n log k) time, O(k) space

Implement a min-heap of size k. Iterate through the array: add elements if the heap has fewer than k items, otherwise only add an element if it's larger than the heap's minimum (root). After processing all elements, the heap's root is the kth largest. The key insight is that you only need to maintain k candidates, not sort the entire array. This achieves O(n log k) time and O(k) space. QuickSelect offers O(n) average time, but its worst case is O(n²), making the heap approach more reliable for interviews.

Find the lowest common ancestor of two nodes in a binary tree

asked in 9 reportsmediumO(n) time, O(h) space

Recursively traverse the tree checking both left and right subtrees. When you find a node where both target nodes exist in different subtrees, that's the LCA. If both exist in one subtree, recurse into that subtree only. The key insight is that a single DFS pass suffices—you're finding where the paths to both nodes diverge. This works because trees have exactly one path between any two nodes.

Answer behavioral questions using the STAR framework about professional experience

asked in 9 reports

Use STAR: Situation (context), Task (challenge), Action (your specific steps), Result (quantified outcomes). Meta prioritizes ownership and measurable impact—always connect your actions to business results with metrics. Emphasize individual contributions over team achievements. Demonstrate learning from failures. Select stories showcasing initiative, cross-functional collaboration, and cultural alignment. Prepare 4-5 diverse examples spanning leadership, conflict resolution, and technical judgment. Avoid generic narratives; use specific details and numbers. Meta evaluates how you think through ambiguity and drive outcomes.

Implement a function to compute x raised to the power of n.

asked in 8 reportsmediumO(log n) time, O(1) space (iterative)

Use binary exponentiation (exponent halving) instead of naive multiplication. If n is even, compute x^(n/2) recursively and square the result; if odd, multiply x by x^(n-1). For negative exponents, compute x^|n| then return 1/result. Handle n=0 (return 1) and negative numbers. The key insight: each recursion halves n, reducing iterations from n to log(n). Implement iteratively with bit manipulation for space efficiency.