
Meta Interview Questions
69 real coding interview questions recently asked at Meta, spanning Arrays and Strings, Linked Lists, Trees and Graphs, and 4 more topics, with a real difficulty tag and a direct LeetCode link for every question.
By DevsUnite · 69 Problems
Total Problems: 69Difficulty Levels:EasyMediumHard
A stack-based string problem: you scan the string tracking indices of unmatched parentheses (pushing open-paren indices onto a stack and popping when a matching close is found), then remove any indices left on the stack or any close parens with no matching open. It tests whether a candidate can correctly track and later reference input positions rather than just counting balance, since simple counter-based approaches miss which specific characters to remove. It's a well-known Meta-favorite string/stack problem, frequently paired with a follow-up about restoring the closest valid string.
A two-pointer palindrome problem with a twist: after finding the first mismatched pair moving inward from both ends, you must check whether skipping either the left or right character produces a valid palindrome for the remainder. It tests whether a candidate can extend a straightforward two-pointer palindrome check into a one-off greedy branch, and correctly reason that only one deletion is ever allowed. It's frequently used as a natural follow-up after the plain Valid Palindrome problem in the same interview.
A classic two-pointer string problem: you compare characters from both ends moving inward, skipping non-alphanumeric characters and normalizing case along the way. It's a fast check of whether a candidate can handle input-cleaning logic and pointer bookkeeping correctly, and it's frequently used as a warm-up before harder palindrome variants like Valid Palindrome II. Its simplicity makes it a good gauge of coding speed and precision under time pressure rather than algorithmic depth.
Count the number of contiguous subarrays that sum to exactly k. The efficient solution uses a running prefix sum alongside a hash map counting how many times each prefix-sum value has occurred, since a subarray sums to k exactly when the difference between two prefix sums equals k. It's a strong test of the prefix-sum-plus-hash-map pattern, a technique that generalizes to many other subarray-counting problems.
Compute, for each index, the product of all array elements except the one at that index, without using division. The standard O(1)-extra-space solution builds a running prefix product and running suffix product in two passes, multiplying them together for the final answer. It tests array manipulation and space-optimization thinking — specifically whether a candidate can avoid the naive division-based shortcut and still hit optimal time and space.
An in-place array problem: you move all non-zero elements to the front in their original relative order while pushing zeroes to the end, ideally in a single pass using a slow/fast pointer pair and minimizing swaps or writes. It tests whether a candidate can reason about in-place array mutation without extra space while maintaining relative order, a common building block for larger array manipulation problems. It's typically used as a fast confidence-building problem early in an interview.
A stack-and-string-parsing problem: evaluate an expression containing +, -, *, / (no parentheses) while respecting standard operator precedence. The typical approach scans left to right, pushing signed numbers onto a stack and immediately resolving * and / against the last pushed value, then summing the stack at the end. It's a solid check of careful state-machine parsing and edge-case handling (multi-digit numbers, whitespace, consecutive operators) under time pressure.
An array problem best solved by scanning from right to left while tracking the maximum height seen so far, keeping any building taller than everything to its right (since those are the ones with an unobstructed ocean view). It tests whether a candidate can find the right traversal direction to turn what looks like an O(n²) comparison problem into a single O(n) pass, similar in spirit to a monotonic stack problem. It's a good signal for recognizing when a reversed scan simplifies a 'compare against everything to one side' problem.
A counting/hash map problem: you tally the frequency of each character in the string to be sorted, then output characters in the order specified by the custom-order string (consuming counts as you go), and append any leftover characters not mentioned in the order at the end. It tests basic but precise hash map or counting-array manipulation and careful handling of characters absent from the custom order. It's typically a fast, low-friction problem confirming string/hash map fluency early in an interview.
Given an array and an integer k, determine whether the array has a contiguous subarray of size at least two whose sum is a multiple of k. It tests whether a candidate can use the prefix-sum-modulo trick — storing the first index at which each remainder (prefix sum mod k) occurs in a hash map, since two prefixes sharing the same remainder means the subarray between them sums to a multiple of k. It's a classic example of turning a divisibility condition into a hash-map lookup problem, a pattern that appears in several subarray-sum variants.
A string-simulation problem that reimplements grade-school addition: you walk both number strings from the least significant digit, add corresponding digits plus a running carry, and prepend each result digit, without converting the strings to native integers (real interview variants extend to numbers larger than fit in standard integer types). It tests careful handling of differing string lengths, the trailing carry, and off-by-one indexing. It's a good signal for meticulous, low-abstraction coding rather than algorithmic insight.
A greedy digit-array problem: to maximize a number with at most one swap, you want to move the largest available later digit as far left as possible, which you can find efficiently by tracking, for each digit position, the rightmost occurrence of each digit 0-9. It tests whether a candidate can reformulate 'try every pair of swaps' (an O(n²) brute force) into a single-pass greedy solution using precomputed last-occurrence indices. It's a solid Medium-tier signal for translating a brute-force intuition into an optimized one.
A two-pointer string-parsing problem: you walk the word and its abbreviation simultaneously, matching literal characters directly and consuming runs of digits in the abbreviation to skip that many characters in the word, while enforcing rules like no leading zeros in a number. It tests careful edge-case handling in parsing logic rather than any advanced algorithm. It's commonly used to check attention to detail and defensive coding under multiple validation constraints at once.
A straightforward two-pointer string problem: you build the result by alternating characters from each input string and appending whatever remains once the shorter string is exhausted. It mainly tests careful index management and clean handling of unequal string lengths rather than any deep algorithmic insight. It's typically used as a fast warm-up problem to confirm basic string-manipulation fluency.
A matrix-traversal simulation problem: you output elements along each diagonal, alternating traversal direction (up-right, then down-left) between successive diagonals, which requires careful boundary handling whenever a diagonal walk hits the top, bottom, left, or right edge of the matrix. It tests whether a candidate can simulate a non-trivial 2D traversal pattern correctly across many edge cases without an elegant closed-form shortcut. It's a solid signal for meticulous index bookkeeping under a moderately complex traversal rule.
A classic in-place array algorithm: find the rightmost position where the sequence stops strictly increasing (scanning from the right), swap that element with the smallest element to its right that's still larger than it, then reverse the suffix to get the smallest lexicographic arrangement greater than the current one. It tests whether a candidate knows or can derive this specific non-obvious three-step algorithm, since a naive approach (generating and sorting all permutations) doesn't scale. It's a strong signal for algorithmic pattern recognition, since the technique itself, not just the coding, is the crux of the problem.
A two-pointer problem over two separately-sorted lists of intervals: you advance through both lists simultaneously, computing the overlap of the current pair of intervals when one exists, and advance whichever interval ends first. It tests whether a candidate can correctly reason about interval overlap conditions and pointer advancement logic without missing or double-counting intersections. It's a good Medium-tier signal for interval-based two-pointer technique, a pattern that recurs across many scheduling-style problems.
A string-parsing and validation problem: you must determine whether an input string is a valid IPv4 address, valid IPv6 address, or neither, which requires splitting on the right delimiter and checking format-specific rules (e.g. no leading zeros and ranges 0-255 for IPv4; valid hex digit groups of correct length for IPv6). It tests meticulous, defensive parsing across many edge cases rather than any real algorithmic technique. It's a strong signal for how a candidate handles a long list of finicky validation rules without missing one under time pressure.
A stack-based string problem: you maintain a stack of (character, count) pairs, incrementing the count when the next character matches the stack top and popping the entry once its count reaches k, then reconstructing the remaining string. It tests whether a candidate can generalize the simpler 'remove adjacent duplicate pairs' pattern to an arbitrary k using a stack that tracks run-lengths rather than repeatedly rescanning the string. It's a good signal for extending a known stack pattern to a parameterized version under time pressure.
A string problem with a number-theory core: two strings have a valid 'GCD string' only if concatenating them in both orders gives the same result, and if so, the answer is the prefix of length gcd(len1, len2). It tests whether a candidate can find and justify a non-obvious mathematical characterization rather than brute-forcing over all possible candidate substrings. It's a good signal for mathematical reasoning applied to a string problem, a less common combination than typical string/array interview questions.
A simple matrix-traversal problem: a matrix is Toeplitz if every diagonal from top-left to bottom-right has the same value, which you can check by comparing each cell to its lower-right neighbor across the whole matrix. It's a fast, low-friction signal for correct 2D indexing and boundary handling, with a natural follow-up about handling a matrix too large to fit in memory (processed as a row-by-row stream). It's typically used as a quick early-interview problem.
A problem that can be solved either with a trie (inserting every prefix of every number in one array as digit sequences, then querying the longest matching prefix against numbers in the other array) or with a hash set of all prefixes for fast lookup. It tests whether a candidate recognizes 'longest common prefix across many numbers' as a trie-shaped problem rather than doing pairwise comparisons, which would be far too slow at scale. It's a solid Medium-tier signal for trie fluency, a data structure many candidates only know in theory.
A sliding window problem using a hash map to track character counts within the current window: you expand the window's right edge, and shrink from the left whenever the number of distinct characters in the map exceeds k, tracking the maximum valid window length throughout. It tests the general 'sliding window plus frequency map' pattern that recurs across many string problems (e.g. longest substring without repeating characters, minimum window substring). It's a strong Medium-tier signal for whether a candidate can manage window state and shrink conditions correctly.
A design problem built around a 2D prefix-sum table: you precompute cumulative sums so that any rectangular sub-region's sum can be answered in O(1) using inclusion-exclusion over four prefix-sum lookups, after an O(rows × cols) preprocessing step. It tests whether a candidate can correctly derive and index the 2D prefix-sum formula, which trips up many candidates on the exact off-by-one boundary terms. It's a good signal for whether someone has internalized prefix sums beyond the simpler 1D case.
A Hard-tier array problem solved with an in-place, index-as-hash-table technique: you place each positive number ≤ n at its correct index (value v goes to index v-1) via swaps, then scan for the first index whose value doesn't match, all within O(n) time and O(1) extra space. It tests whether a candidate can find a genuinely non-obvious optimal solution rather than the natural but disallowed approach (a hash set), since the O(1)-space constraint is the entire point of the problem. It's a strong signal for algorithmic creativity under a tight space constraint, commonly used to differentiate strong candidates in a Hard-tier slot.
Convert a non-negative integer into its English words representation (e.g. 1234567 -> "One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"). The approach breaks the number into groups of three digits, converts each group using lookup tables for ones/teens/tens and hundreds, then appends the appropriate scale word (thousand, million, billion) per group. It's not algorithmically deep, but it's implementation-heavy with many easy-to-miss edge cases (zero, teens, trailing zero groups), making it a good test of careful, methodical coding under a large but mechanical spec.
Log in to save your progress, favorites, and notes to your account.
Frequently asked questions
What coding interview questions does Meta ask?
This page tracks 69 real, recently reported Meta coding interview questions, organized by topic: Arrays and Strings, Linked Lists, Trees and Graphs, and 4 more topics.
How many Meta interview questions are on this list?
69 questions in total: 12 Easy, 52 Medium, and 5 Hard, each linked to its real LeetCode problem page.
Is it free to use?
Yes. Browsing every problem on this page is completely free, with no account required. Creating a free DevsUnite account lets you save your checked-off progress, star favorites, and add personal notes that sync across devices.
Do I need an account to track my progress?
You can read and solve every problem without logging in. An account is only required to mark a problem as done, star it, or add a note. Those actions save to your account instead of resetting on refresh.