Meta logo

Meta Hard Interview Questions

9 hard-level practice questions for Meta technical interviews

coding Hard Verified Question #1

1. OA[CodeSignal] Cloud File Storage System


Category: Graph coding problem
# Question Your task is to implement a simple in-memory cloud storage system that maps objects (files) to their metadata (name, size, etc.). You...
Input: Graph (nodes and edges)
Output: Array
coding Hard Verified Question #2

2. OA[CodeSignal] Design Banking System


Category: Graph coding problem
# Question Design a banking system that supports account management, transactions, and various financial operations.
Input: Graph (nodes and edges)
Output: Computed result
coding Hard Verified Question #3

3. Minimum Prefix Subset


Category: Tree coding problem
# Question Given a list of strings, find the minimum subset of prefixes that can represent the entire input set. A string is "represented" if it...
Input: Array of strings
Output: Integer
coding Hard Verified Question #4

4. OA[CodeSignal] In-Memory Database


Category: Graph coding problem
# Description Implement a simplified in-memory database that supports record manipulation with various operations. The system should handle basic...
Input: Graph (nodes and edges)
Output: Array
coding Hard Verified Question #5

5. [CodeSignal] House Segments After Destruction


Category: Array coding problem
# Question You are monitoring the building density in a district of houses. The district is represented as a number line, where each house is located...
Input: Array of integers
Output: Array
coding Hard Verified Question #6

6. Expression Simplifier


Category: String coding problem
Given an algebraic expression string containing single lowercase-letter variables, the operators + and -, and parentheses ( and ), simplify...
Input: String
Output: Computed result
system design Hard caching #1

1. [OA] LRU Cache — Implement the caching system for Instagram feed

Instagram relies on providing quick access to user feeds, which requires an efficient cache management system. Design an LRU Cache to ensure optimal performance.
Class LRUCache:
- LRUCache(int capacity): Initializes the cache with a positive size capacity.
- int get(int key): Returns the value of the key if the key exists, otherwise returns -1.
- void put(int key, int value): Update the value of the key if present, or add the key-value pair if not existing. When the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
Example 1:
Input: LRUCache(2); cache.put(1, 1); cache.put(2, 2); cache.get(1); cache.put(3, 3); cache.get(2); cache.put(4, 4); cache.get(1); cache.get(3); cache.get(4);
Output: 1; -1; 3; 4
Constraints:
- capacity is always positive and will not exceed 1000
- The operations get and put will always be called with valid keys.
coding Hard graph #2

2. [OA] Graph Traversal — Find shortest path for the Facebook Events navigation

This problem simulates navigation through Facebook Events. Efficient pathfinding is crucial for enhancing user experience in discovering events.
Given an undirected graph represented as an adjacency list, return the shortest path from node start to node end.
Example 1:
Input: edges = [[0, 1], [1, 2], [2, 3]], start = 0, end = 3
Output: [0, 1, 2, 3]
Explanation: The shortest path from node 0 to node 3 is 0 -> 1 -> 2 -> 3.
Example 2:
Input: edges = [[0, 1], [1, 2], [0, 2], [2, 3]], start = 0, end = 3
Output: [0, 2, 3]
Constraints:
- 1 <= edges.length <= 10^4
- Each edge is a pair of distinct integers.
coding Hard sliding window #3

3. [OA] Sliding Window — Find the longest substring containing at most two distinct characters for Facebook Messenger

This problem is important for optimizing the chat list experience in the Messenger app. By ensuring quick access to frequently used contacts, we can enhance user engagement.
Given a string s, find the length of the longest substring containing at most two distinct characters.
Example 1:
Input: s = "eceba"
Output: 3
Explanation: The substring is "ece" which its length is 3.
Example 2:
Input: s = "ccaabbb"
Output: 5
Explanation: The substring is "aabbb" which its length is 5.
Constraints:
- 1 <= s.length <= 10^5
- s consists of English letters, digits, symbols, and spaces.

Start practicing Meta questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free