Facebook Coding Interview Questions
Facebook problems
Meta runs a full process: two coding rounds with medium-to-hard problems, one system design, and one behavioral. The most-asked patterns are two pointers, BFS/DFS, and interval problems. Practice medium and hard problems under a strict 45-minute clock.
Facebook Interview Loop Structure
- • Solve 2 medium problems within 45 minutes under strict time pressure
- • Write clean, idiomatic code without syntax hesitation
- • Immediately outline brute-force before jumping to the optimal solution
4-Week Preparation Strategy for Facebook
Action PlanTo maximize your offer probability at Facebook, avoid random LeetCode grinding. Follow this structured 4-week roadmap tailored to Facebook's specific interview loop and evaluation bar:
Week 1: High-Frequency Patterns
Focus on foundational patterns tested heavily at Facebook: Two Pointers, Sliding Window, and Hash Map frequency tracking. Solve 10–12 Easy/Medium questions and establish code muscle memory without syntax lookups.
Week 2: Advanced Graph & Tree Drills
Master BFS, DFS, Topological Sorting, and Priority Queues (Min/Max Heaps). Practice articulating state transitions and recursion stack depth trade-offs under real-time interviewer pressure.
Week 3: Timed Mock Coding & Complexity
Simulate real 45-minute technical screens. Spend 5 minutes clarifying requirements, 10 minutes discussing brute-force vs optimal trade-offs, 20 minutes coding cleanly, and 10 minutes dry-running boundary test cases.
Week 4: System Architecture & Behavioral STAR
Draft 5 distinct STAR method stories (Situation, Task, Action, Result) mapped to Facebook's core principles. Review distributed systems fundamentals: caching tiers, partitioning, rate limiting, and database consistency models.
💡 What Facebook Interviewers Evaluate:
Interviewers score candidates across 4 independent pillars: Algorithmic Optimality (arriving at optimal Big-O), Code Craftsmanship (modular functions, clean naming, zero syntax debt), Communication & Thinking Out Loud (proactive collaboration, asking clarifying questions), and Edge Case Rigor (null checks, integer overflows, duplicate inputs).
High Frequency at Facebook
Most AskedThese problems appear most frequently in Facebook interviews based on reported data.
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Longest Substring Without Repeating Characters
#String
#Hash Map
#Sliding Window | Medium | Solution | ||
| Minimum Window Substring
#String
#Hash Map
#Sliding Window | Hard | Solution | ||
| Find All Anagrams in a String
#String
#Hash Map
#Sliding Window | Medium | Solution | ||
| Minimum Size Subarray Sum
#Array
#Sliding Window
#Binary Search | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| 3Sum
#Array
#Two Pointers
#Sorting | Medium | Solution | ||
| Container With Most Water
#Array
#Two Pointers
#Greedy | Medium | Solution | ||
| Trapping Rain Water
#Array
#Two Pointers
#Stack | Hard | Solution | ||
| Valid Palindrome
#String
#Two Pointers | Easy | Solution | ||
| Move Zeroes
#Array
#Two Pointers | Easy | Solution | ||
| Sort Colors
#Array
#Sorting
#Two Pointers | Medium | Solution | ||
| Squares of a Sorted Array
#Array
#Two Pointers
#Sorting | Easy | Solution | ||
| Valid Palindrome II
#String
#Greedy
#Two Pointers | Easy | Solution | ||
| Encode and Decode Strings
#Array
#String
#Design | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Binary Search
#Array
#Binary Search | Easy | Solution | ||
| Search in Rotated Sorted Array
#Array
#Binary Search | Medium | Solution | ||
| Koko Eating Bananas
#Array
#Binary Search | Medium | Solution | ||
| Find Peak Element
#Array
#Binary Search | Medium | Solution | ||
| Capacity to Ship Packages Within D Days
#Array
#Binary Search | Medium | Solution | ||
| Split Array Largest Sum
#Array
#Binary Search
#Dynamic Programming | Hard | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Subarray Sum Equals K
#Array
#Hash Map
#Prefix Sum | Medium | Solution | ||
| Product of Array Except Self
#Array
#Prefix Product | Medium | Solution | ||
| Contiguous Array
#Array
#Hash Map
#Prefix Sum | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Two Sum
#Array
#Hash Map | Easy | Solution | ||
| Group Anagrams
#String
#Hash Map
#Sorting | Medium | Solution | ||
| Top K Frequent Elements
#Array
#Hash Map
#Heap | Medium | Solution | ||
| Longest Consecutive Sequence
#Array
#Hash Set | Medium | Solution | ||
| LRU Cache
#Hash Table
#Linked List
#Design | Medium | Solution | ||
| Subarray Sum Divisible by K
#Array
#Hash Table
#Prefix Sum | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Valid Parentheses
#String
#Stack | Easy | Solution | ||
| Daily Temperatures
#Array
#Stack
#Monotonic Stack | Medium | Solution | ||
| Remove K Digits
#String
#Stack
#Greedy | Medium | Solution | ||
| Basic Calculator II
#Math
#String
#Stack | Medium | Solution | ||
| Simplify Path
#String
#Stack | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Number of Islands
#Array
#DFS
#BFS | Medium | Solution | ||
| Binary Tree Level Order Traversal
#Tree
#BFS | Medium | Solution | ||
| Word Ladder
#Hash Set
#BFS
#String | Hard | Solution | ||
| 01 Matrix
#Array
#BFS
#Matrix | Medium | Solution | ||
| Walls and Gates
#Array
#BFS
#Matrix | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Kth Largest Element in an Array
#Array
#Heap
#Sorting | Medium | Solution | ||
| Task Scheduler
#Array
#Heap
#Greedy | Medium | Solution | ||
| Merge K Sorted Lists
#Linked List
#Heap
#Divide and Conquer | Hard | Solution | ||
| K Closest Points to Origin
#Array
#Math
#Divide and Conquer | Medium | Solution | ||
| Reorganize String
#Hash Table
#String
#Greedy | Medium | Solution | ||
| Minimum Cost to Connect Sticks
#Array
#Greedy
#Heap | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Reverse Linked List
#Linked List
#Recursion | Easy | Solution | ||
| Reorder List
#Linked List
#Two Pointers
#Stack | Medium | Solution | ||
| Copy List with Random Pointer
#Hash Table
#Linked List | Medium | Solution | ||
| Palindrome Linked List
#Linked List
#Two Pointers
#Stack | Easy | Solution | ||
| Reverse Nodes in k-Group
#Linked List
#Recursion | Hard | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Validate Binary Search Tree
#Tree
#DFS
#BST | Medium | Solution | ||
| Lowest Common Ancestor of a BST
#Tree
#DFS
#BST | Medium | Solution | ||
| Binary Tree Maximum Path Sum
#Tree
#DFS
#DP | Hard | Solution | ||
| Serialize and Deserialize Binary Tree
#Tree
#DFS
#BFS | Hard | Solution | ||
| Diameter of Binary Tree
#Tree
#DFS
#Binary Tree | Easy | Solution | ||
| Binary Tree Right Side View
#Tree
#DFS
#BFS | Medium | Solution | ||
| Kth Smallest Element in a BST
#Tree
#DFS
#BST | Medium | Solution | ||
| Count Good Nodes in Binary Tree
#Tree
#DFS
#BFS | Medium | Solution | ||
| Populating Next Right Pointers in Each Node
#Linked List
#Tree
#DFS | Medium | Solution | ||
| Subtree of Another Tree
#Tree
#Depth-First Search
#String Matching | Easy | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Clone Graph
#Graph
#DFS
#BFS | Medium | Solution | ||
| Pacific Atlantic Water Flow
#Graph
#DFS
#BFS | Medium | Solution | ||
| Surrounded Regions
#Array
#DFS
#BFS | Medium | Solution | ||
| All Paths From Source to Target
#Backtracking
#DFS
#BFS | Medium | Solution | ||
| Cheapest Flights Within K Stops
#Dynamic Programming
#DFS
#BFS | Medium | Solution | ||
| Graph Valid Tree
#Depth-First Search
#Breadth-First Search
#Union Find | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Word Break
#String
#DP
#Hash Set | Medium | Solution | ||
| Decode Ways
#String
#DP | Medium | Solution | ||
| Partition Equal Subset Sum
#Array
#Dynamic Programming | Medium | Solution | ||
| Target Sum
#Array
#Dynamic Programming
#Backtracking | Medium | Solution | ||
| Best Time to Buy and Sell Stock
#Array
#Dynamic Programming | Easy | Solution | ||
| Palindromic Substrings
#String
#Dynamic Programming | Medium | Solution | ||
| Longest Palindromic Substring
#String
#Dynamic Programming | Medium | Solution | ||
| Maximum Product Subarray
#Array
#Dynamic Programming | Medium | Solution | ||
| Minimum Path Sum
#Array
#Dynamic Programming
#Matrix | Medium | Solution | ||
| Regular Expression Matching
#String
#Dynamic Programming
#Recursion | Hard | Solution | ||
| Interleaving String
#String
#Dynamic Programming
#BFS | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Jump Game II
#Array
#Greedy
#DP | Medium | Solution | ||
| Non-overlapping Intervals
#Array
#Greedy
#Dynamic Programming | Medium | Solution | ||
| Meeting Rooms II
#Array
#Greedy
#Sorting | Medium | Solution | ||
| Queue Reconstruction by Height
#Array
#Greedy
#Sorting | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Subsets
#Array
#Backtracking
#Bit Manipulation | Medium | Solution | ||
| Combination Sum
#Array
#Backtracking | Medium | Solution | ||
| Word Search
#Array
#Matrix
#Backtracking | Medium | Solution | ||
| Letter Combinations of a Phone Number
#Hash Table
#String
#Backtracking | Medium | Solution | ||
| Generate Parentheses
#String
#Dynamic Programming
#Backtracking | Medium | Solution | ||
| Palindrome Partitioning
#String
#Dynamic Programming
#Backtracking | Medium | Solution | ||
| Subsets II
#Array
#Backtracking
#Bit Manipulation | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Implement Trie (Prefix Tree)
#Design
#Trie | Medium | Solution | ||
| Design Add and Search Words Data Structure
#Design
#Trie
#DFS | Medium | Solution | ||
| Replace Words
#Array
#Hash Table
#String | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Accounts Merge
#Graph
#Union Find
#DFS | Medium | Solution | ||
| Number of Provinces
#DFS
#BFS
#Union-Find | Medium | Solution | ||
| Most Stones Removed with Same Row or Column
#Hash Table
#DFS
#Union-Find | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Largest Rectangle in Histogram
#Array
#Stack
#Monotonic Stack | Hard | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Course Schedule
#Graph
#DFS
#BFS | Medium | Solution | ||
| Course Schedule II
#Graph
#DFS
#BFS | Medium | Solution | ||
| Alien Dictionary
#Array
#String
#Graph | Hard | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Counting Bits
#DP
#Bit Manipulation | Easy | Solution | ||
| Sum of Two Integers
#Math
#Bit Manipulation | Medium | Solution | ||
| Single Number II
#Array
#Bit Manipulation | Medium | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Merge Intervals
#Array
#Sorting | Medium | Solution | ||
| Insert Interval
#Array | Medium | Solution | ||
| Meeting Rooms
#Array
#Sorting | Easy | Solution |
| Problem | Difficulty | Solution | Link | |
|---|---|---|---|---|
| Maximal Square
#Array
#Dynamic Programming
#Matrix | Medium | Solution |