# Get Well Prepared for Facebook

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.

1. Longest Substring Without Repeating Characters
2. String to Integer (atoi)
3. Roman to Integer
4. 3Sum
5. Remove Duplicates from Sorted Array
6. Next Permutation
7. Multiply Strings
8. Group Anagrams
10. Minimum Window Substring
11. Merge Sorted Array
12. Valid Palindrome
15. One Edit Distance
16. Product of Array Except Self (Editor’s choice: Frequently asked in a Facebook online assessment.)
17. Integer to English Words (Editor’s choice: Frequently asked in Facebook phone interview.)
18. Move Zeroes
19. Longest Substring with At Most K Distinct Characters
21. Subarray Sum Equals K
22. Valid Palindrome II

These are some popular Linked List questions being asked by Facebook. Add Two Numbers apparently is a popular one according to our user survey.

2. Merge Two Sorted Lists
3. Copy List with Random Pointer
4. 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.

1. Validate Binary Search Tree
2. Flatten Binary Tree to Linked List
3. Binary Tree Maximum Path Sum
4. Clone Graph
5. Binary Tree Right Side View
6. Number of Islands
7. Lowest Common Ancestor of a Binary Tree
8. Binary Tree Paths
9. Alien Dictionary
10. Shortest Distance from All Buildings
11. Diameter of Binary Tree
12. Accounts Merge
13. Convert Binary Search Tree to Sorted Doubly Linked List
14. Is Graph Bipartite?
15. 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.

1. Letter Combinations of a Phone Number (Editor’s choice: Frequently asked in Facebook phone and onsite interviews.)
2. Permutations
3. Permutations II
4. Remove Invalid Parentheses (Editor’s choice: Frequently asked in Facebook phone interview.)
5. Regular Expression Matching
6. Subsets
7. 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.

1. Divide Two Integers
2. Search in Rotated Sorted Array
3. Find First and Last Position of Element in Sorted Array
4. Pow(x, n)
5. Merge Intervals
6. Find Peak Element
8. Intersection of Two Arrays
9. 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.

1. Longest Palindromic Substring
2. Longest Valid Parentheses
3. Decode Ways
5. Word Break
6. Range Sum Query 2D – Immutable
7. 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.

1. LRU Cache
2. Binary Search Tree Iterator
3. Add and Search Word – Data structure design
4. 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.

2. Find All Anagrams in a String
3. Permutation in String
4. Verifying an Alien Dictionary
5. 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.

1. Second Highest Salary
2. Nth Highest Salary
3. Customers Who Never Order
4. Friend Requests I: Overall Acceptance Rate
5. Friend Requests II: Who Has the Most Friends
6. Department Top Three Salaries