Total 79 questions.
Introduction
“Interviewing for a technical job is hard, and so is being the interviewer. You want to get that engineering job at Facebook, and we want to hire the best people (you!). Knowing what to expect on both sides can go a long way toward making the process work better.”
– Carlos Bueno, an engineer in Facebook
Getting well prepared for an interview is important. However, preparing all questions asked is time consuming and stressful. The key points are practice and effective preparation.
LeetCode compiled this list thoroughly so you can save time and get well-prepared for a Facebook interview.
Arrays and Strings
Move Zeroes is a popular one for phone interviews. Note that you may be asked follow up about analyzing and optimizing the number of steps in your algorithm.
- Longest Substring Without Repeating Characters
- String to Integer (atoi)
- Roman to Integer
- 3Sum
- Remove Duplicates from Sorted Array
- Next Permutation
- Multiply Strings
- Group Anagrams
- Add Binary (Editor’s choice: Frequently asked in Facebook phone interview. )
- Minimum Window Substring
- Merge Sorted Array
- Valid Palindrome
- Read N Characters Given Read4
- Read N Characters Given Read4 II – Call multiple times
- One Edit Distance
- Product of Array Except Self (Editor’s choice: Frequently asked in a Facebook online assessment.)
- Integer to English Words (Editor’s choice: Frequently asked in Facebook phone interview.)
- Move Zeroes
- Longest Substring with At Most K Distinct Characters
- Validate IP Address
- Subarray Sum Equals K
- Valid Palindrome II
Linked Lists
These are some popular Linked List questions being asked by Facebook. Add Two Numbers apparently is a popular one according to our user survey.
- Add Two Numbers
- Merge Two Sorted Lists
- Copy List with Random Pointer
- Reorder List
Trees and Graphs
Facebook loves Tree types of problems. One of the Tree questions Facebook really likes to ask is Convert BST to Sorted Doubly Linked List, which you can practice below.
You should also know topological sort and graph traversal as those are still occasionally asked.
- Validate Binary Search Tree
- Flatten Binary Tree to Linked List
- Binary Tree Maximum Path Sum
- Clone Graph
- Binary Tree Right Side View
- Number of Islands
- Lowest Common Ancestor of a Binary Tree
- Binary Tree Paths
- Alien Dictionary
- Shortest Distance from All Buildings
- Diameter of Binary Tree
- Accounts Merge
- Convert Binary Search Tree to Sorted Doubly Linked List
- Is Graph Bipartite?
- Binary Tree Vertical Order Traversal
Recursion
Definitely know how to generate permutations and combinations (subsets), which are great backtracking exercises.
Remove Invalid Parenthesis is a popular one being asked at Facebook, and is also one of our favorite interview questions.
- Letter Combinations of a Phone Number (Editor’s choice: Frequently asked in Facebook phone and onsite interviews.)
- Permutations
- Permutations II
- Remove Invalid Parentheses (Editor’s choice: Frequently asked in Facebook phone interview.)
- Regular Expression Matching
- Subsets
- Strobogrammatic Number II
Sorting and Searching
Interval related problems are quite often asked at Facebook interviews, such as Meeting Rooms II and Merge Intervals. These interval problems typically require you to sort it in order and apply some kind of linear search or binary search technique.
- Divide Two Integers
- Search in Rotated Sorted Array
- Find First and Last Position of Element in Sorted Array
- Pow(x, n)
- Merge Intervals
- Find Peak Element
- First Bad Version
- Intersection of Two Arrays
- Intersection of Two Arrays II
Dynamic Programming
Decode Ways is a popular one being asked by Facebook. It is actually a simplified version of Squished Status, which appeared in Facebook’s coding competition. We also have its variation Decode Ways II for you to practice.
- Longest Palindromic Substring
- Longest Valid Parentheses
- Decode Ways
- Best Time to Buy and Sell Stock (Editor’s choice: Frequently asked in Facebook online assessment.)
- Word Break
- Range Sum Query 2D – Immutable
- Continuous Subarray Sum
Design
Read N Characters Given Read4 and its follow up (part II) are quite often asked at Facebook according to our user survey. This is a pure coding problem, which corresponds well to the type of questions Facebook prefers. It is simple to think of an idea, but translating it to code and taking care of all edge cases is no trivial task.
- LRU Cache
- Binary Search Tree Iterator
- Add and Search Word – Data structure design
- Serialize and Deserialize Binary Tree (Editor’s choice: Frequently asked in Facebook phone interview.)
Others
Here are some other Facebook interview questions for you to practice. Integer to English Words is quite frequently asked according to our user survey.
Find the Celebrity is a cute problem but requires some out of box thinking and Facebook seems to like this problem, too.
- Expression Add Operators
- Find All Anagrams in a String
- Permutation in String
- Verifying an Alien Dictionary
- Interval List Intersections
SQL
Are you applying for a Data Scientist position? You may be asked some basic SQL questions.
Here are some SQL questions which has been asked by Facebook available for you to practice.
- Second Highest Salary
- Nth Highest Salary
- Customers Who Never Order
- Friend Requests I: Overall Acceptance Rate
- Friend Requests II: Who Has the Most Friends
- Department Top Three Salaries