Meta Programming Interview Questions

Subscribe for free interview question feeds

Leave your Email to get the latest Meta interview questions weekly.
We'll never share your email with anyone else.
No spam we promise.

Most Frequently Asked Meta Programming Interview Questions
38 Count and Say
209 Minimum Size Subarray Sum
80 Remove Duplicates from Sorted Array II
252 Meeting Rooms
78 Subsets
67 Add Binary
261 Graph Valid Tree
275 H-Index II
278 First Bad Version
211 Add and Search Word - Data structure design
Excel Sheet Column Title
Binary Search Tree Iterator
200 Number of Islands
125 Valid Palindrome
283 Move Zeroes
117 Populating Next Right Pointers in Each Node II
274 H-Index
79 Word Search
Increasing Triplet Subsequence
49 Group Anagrams
Walls and Gates
50 Pow(x, n)
311 Sparse Matrix Multiplication
98 Validate Binary Search Tree
Read N Characters Given Read4
277 Find the Celebrity
71 Simplify Path
90 Subsets II
325 Maximum Size Subarray Sum Equals k
Binary Tree Level Order Traversal
69 Sqrt(x)
221 Maximal Square
257 Binary Tree Paths
236 Lowest Common Ancestor of a Binary Tree
121 Best Time to Buy and Sell Stock
234 Palindrome Linked List
Remove Duplicates from Sorted Array
88 Merge Sorted Array
238 Product of Array Except Self
33 Search in Rotated Sorted Array
208 Implement Trie (Prefix Tree)
43 Multiply Strings
235 Lowest Common Ancestor of a Binary Search Tree
314 Binary Tree Vertical Order Traversal
161 One Edit Distance
Decode Ways
Valid Parentheses
13 Roman to Integer
127 Word Ladder
Merge Intervals
75 Sort Colors
28 Implement strStr()
285 Inorder Successor in BST
215 Kth Largest Element in an Array
133 Clone Graph
Word Break
206 Reverse Linked List
15 3Sum
Letter Combinations of a Phone Number
1 Two Sum
210 Course Schedule II
341 Flatten Nested List Iterator
377 Combination Sum IV
398 Random Pick Index
404 Sum of Left Leaves
Meeting Rooms II
Insert Delete GetRandom O(1)
477 Total Hamming Distance
461 Hamming Distance
494 Target Sum
525 Contiguous Array
523 Continuous Subarray Sum
535 Encode and Decode TinyURL
543 Diameter of Binary Tree
554 Brick Wall
572 Subtree of Another Tree
578 Get Highest Answer Rate Question
602 Friend Requests II: Who Has the Most Friends
597 Friend Requests I: Overall Acceptance Rate
621 Task Scheduler
637 Average of Levels in Binary Tree
Exclusive Time of Functions
653 Two Sum IV - Input is a BST
670 Maximum Swap
674 Longest Continuous Increasing Subsequence
673 Number of Longest Increasing Subsequence
680 Valid Palindrome II
647 Palindromic Substrings
Best Time to Buy and Sell Stock with Transaction Fee
721 Accounts Merge
Number Of Corner Rectangles
764 Largest Plus Sign
785 Is Graph Bipartite?
784 Letter Case Permutation
268 Missing Number
801 Minimum Swaps To Make Sequences Increasing
824 Goat Latin
825 Friends Of Appropriate Ages
394 Decode String
265 Paint House II
Remove Invalid Parentheses
25 Reverse Nodes in k-Group
Merge k Sorted Lists
158 Read N Characters Given Read4 II - Call multiple times
85 Maximal Rectangle
57 Insert Interval
128 Longest Consecutive Sequence
273 Integer to English Words
297 Serialize and Deserialize Binary Tree
10 Regular Expression Matching
218 The Skyline Problem
269 Alien Dictionary
146 LRU Cache
Expression Add Operators
68 Text Justification
Split Array Largest Sum
Wildcard Matching
76 Minimum Window Substring
639 Decode Ways II
Design Search Autocomplete System
689 Maximum Sum of 3 Non-Overlapping Subarrays
745 Prefix and Suffix Search
Queue Management

How to use Queues in your system?

Search Chat Messages

Design a chat app like FB Messenger/Whatsapp/Slack and search the chat history by keywords…

Weather Data Service

Design a scalable weather data service for your customers...

Design GitHub

Design a version control system like GitHub…

Design Smart Lock

Design the smart lock system...

Search Matrix

Given a 0-1 matrix, where 1 means block, 0 means road, return the number of paths from row one to row bottom...

Design Ads Click Counter System

Think about ads platform like Google/Meta. There are billions of ads clicks per day. Now we need to design a dashboard to visualize the ads performance. More specifically, you need to implement a service to return the number of ads clicks within a certain time frame...

Sort Strings Based on Custom Alphabet Order
Decode String
Read File by Read4 API | Read N Characters Given Read4
Find Leftmost 0 in Sorted 2D Array ⭐
Get Product of Array Except Self ⭐
Three Sum
Find Sum of Columns in Binary Tree ⭐
Binary Tree Vertical Order Traversal Sum
Build String with Words in Dictionary
Integer to English Words
Find Subarray with the Maximum Sum ⭐
Kadane's Algorithm Greedy ⭐⭐
File Checker

Given an API reads 1 char at a time from a file, check if two files are identical...

Max Submatrix Sum

Given a matrix and an integer k, return the maximum sum of all the k x k matrices

Can Make Palindrome

Given a list of lowercase letters, find whether the letters can make a palindromic string...

Measure Island Border

Given a binary matrix where 1 denotes land and 0 denotes water, return the number of border tiles...

Maximum Difference Between Ancestor and Descendant

Given a binary tree, find the max difference between an ancestor and its descendant...

Canonical Path

Given the absolution path to a folder in Unix, convert it to the canonical path...

Bejeweled Scores

A 10 x 10 board is filled with randomly placed gems. A match occurs when 3 or more gems of the same color line up in a row either horizontally or vertically...

Add Bold Tags To String

Given a string S and a list of key terms, return a string with the key terms surrounded by tags...

Regex Dictionary

Design a class that stores words and enable regex search on words...

Subtree Average

Given a binary tree, find out every tree node where its value equal to the average of all nodes in this subtree...

Longest Monotonic Path in Tree II

Find out the length of longest monotonic path starting from any node to its descendent node in a binary search tree...

Longest Monotonic Path in Tree I

Find out the length of longest monotonic path starting from the root node of a binary search tree...

Count Number in Sorted Array

Given a sorted array of integers and a target number, return the count of the target number...

Minimum Time to Complete Tasks

Given a project with a list of tasks, find out the minimum amount of time to complete the project...

Longest Monotonic Path in Tree III

Find out the length of longest monotonic path starting from any node to its descendent node in a binary tree...

Intersection Two Lists of Intervals

Given two lists of intervals, each interval denoted as [start, end], find the intersection (overlapped segments) between the lists...

Min Steps To Remove Increasing Sequence

Given an array of numbers, remove the increasing sequences until there is no change.
...

Print Matrix Diagonally

[Facebook Onsite Question] Print Matrix Diagonally

Sort String By Custom Alphabetical Order

[Facebook Onsite Question] Sort String By Custom Alphabetical Order

Task Scheduler II

[Facebook Onsite Question] Task Scheduler II

Given an array of numbers [1, 2, 3, 1, 4, 2, ..... ]. (Notice there could be duplicate) Also given an integer N, which means two same numbers must be N space away. 
You are going to write a program to find out a way to padding zeros to these numbers with the minimum total length...

Shortest Word Distance

Shortest Word Distance

Merge Segments

# There's a room with a TV and people are coming in and out to watch it. The TV is on only when there's at least a person in the room.
# For each person that comes in, we record the start and end time. We want to know for how long the TV has been on. In other words:
# Given a list of arrays of time intervals, write a function that calculates the total amount of time covered by the intervals.
# For example:
# input = [(1,4), (2,3)]
# > 3
# input = [(4,6), (1,2)]
# > 3
# input = {{1,4}, {6,8}, {2,4}, {7,9}, {10, 15}}
# > 11

Set Matrix Zeroes II

Google On-site 2018 Winter

There are orbs on an NxM board ('O' denotes orb. 'X' denotes empty slot).

Whenever two orbs are in the same column or the same row, you get to erase one of them.

Try to erase as many orbs as possible.

Find the minimum number of orbs remained on board eventually.

Randomly select a number in an array

How to randomly select a number in an array?
array: [15, 2, 4, 5, 1, -2, 0]

Follow-up:
Given a second array freq where freq[i] represents the occurrence of the ith number in array, how to randomly select a number in array based on the frequency.

Extra requirement:
Could you complete the selection in a single-pass(go through each array only once)?

Ring Buffer

Implement a ring buffer

Cut Binary Tree

Give a binary tree, find if it's possible to cut the tree into two halves of equal sum. You can only cut one edge.

Split BST

Given a Binary Search Tree (BST) with root node root, and a target value V, split the tree into two subtrees where one subtree has nodes that are all smaller or equal to the target value, while the other subtree has all nodes that are greater than the target value. It's not necessarily the case that the tree contains a node with value V.

Longest Arithmetic Progression

In the array {1, 6, 3, 5, 9, 7}, the longest arithmetic sequence is 1, 3, 5, and 7