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
codingHardVerified 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
codingMediumVerified Question#3
3. Friend Requests Sent
Category: Algorithm coding problem
Question Given a list of ages representing users in a social network, calculate the total number of friend requests each user will send based on...
Input: List Output: Computed result
codingHardVerified Question#4
4. 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
codingMediumVerified Question#5
5. Shortest Substring with Alphabet
Category: Sliding window coding problem*This is a popular twist Meta interviewers often put on the classic leetcode problem to find a minimum window substring.* Given an input string and...Input: String Output: Integer
codingMediumVerified Question#6
6. Shortest Substring with N Unique Characters
Category: String coding problem
Shortest Substring with N Unique Characters *This is a variation of the leetcode problem* Given a string s and an integer n, find the length of...
Input: String Output: Computed result
codingHardVerified Question#7
7. 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
codingEasyVerified Question#8
8. [CodeSignal] Count Non-Dominant Elements
Category: Array coding problem
Question Given an array of integers numbers, count all elements that are not equal to numbers[0] or numbers[1] (if those indices exist in the...
Input: Array of integers Output: Computed result
codingEasyVerified Question#9
9. [CodeSignal] Sort Words By Vowel Consonant Difference
Category: Array coding problem
Question You are given a string text consisting of unique lowercase English words separated by spaces. For each word, compute the absolute...
Input: Array Output:** Computed result
codingMediumVerified Question#10
10. [CodeSignal] Warehouse Robot Commands
Category: Matrix coding problem
Question In a highly automated warehouse, a robot organizes packages stored in a rectangular grid. The grid is represented as a 2D list of integers...
Input: Matrix (2D array) Output: Computed result
codingHardVerified Question#11
11. [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
codingMediumVerified Question#12
12. Distribution Center Placement
Category: Array coding problemA logistics company is expanding its distribution network along a single highway. You are given an array of integers locations representing the...Input: Array of integers Output: Computed result
codingHardVerified Question#13
13. Expression Simplifier
Category: String coding problemGiven an algebraic expression string containing single lowercase-letter variables, the operators + and -, and parentheses ( and ), simplify...Input: String Output: Computed result
codingMediumVerified Question#14
14. Minimum Sum Tree Path
Category: Binary tree coding problem
Minimum Sum Tree Path
Input: Binary tree Output: Computed result
technicalMediumVerified Question#15
15. How to pass AI Enabled Coding Rounds From FAANG Interviewer
Category: Algorithm coding problem
Tips For AI Coding Rounds AI coding rounds are not as different from regular coding rounds as you might think. The interviewer still needs to get...
Input: Given input Output: Computed result
system designSeniordistributed systems#1
1. [OA] Distributed Config Manager — Design a configuration management system for Meta's distributed services
Meta's applications often rely on various configurations across multiple services. A robust configuration manager ensures that the services get the right configurations seamlessly. Your task is to design a ConfigManager class that handles configuration loading and updates.Problem statement: Define the ConfigManager class that stores configurations for different services and provides methods to retrieve and update these configurations.
def __init__(self): Initializes the configuration manager.
def set_config(self, service_id: str, config: Dict[str, Any]) -> None: Sets or updates the configuration for a specific service.
def get_config(self, service_id: str) -> Dict[str, Any]: Retrieves the configuration for a specific service.
Example 1: Input: config_manager = ConfigManager(); config_manager.set_config('auth_service', {'retry_limit': 3}); config = config_manager.get_config('auth_service') Output: {'retry_limit': 3} Explanation: The configuration for 'auth_service' is correctly stored and retrieved.Constraints:
1 <= service_id.length <= 100
The configuration dictionary size can be at most 10^4 key-value pairs.
system designSeniorapi design#2
2. [OA] Service Health Monitor — Design a health monitoring service for Meta's microservices architecture
In Meta's vast microservices ecosystem, persistent health monitoring is crucial to maintain service reliability and uptime. Your task is to design a class that implements a health monitoring system that tracks various services' health statuses.Problem statement: Define a class HealthMonitor that allows registering services and conducting regular health checks.
def __init__(self): Initializes the health monitor.
def register_service(self, service_id: str) -> None: Registers a new service to monitor.
def health_check(self, service_id: str) -> bool: Conducts a health check and returns the service's health; returns True or False.
Example 1: Input: monitor = HealthMonitor(); monitor.register_service('user_service'); status = monitor.health_check('user_service') Output: True Explanation: The user_service is registered and passes the health check.Constraints:
1 <= service_id.length <= 100
Health checks should handle at least 10^5 service registrations.
codingHardinfra#3
3. [OA] Dockerfile Optimization — Write an optimized Dockerfile for a scalable Meta service
Meta utilizes microservices architecture where efficient container images are essential for quick deployments. Your task is to optimize a given Dockerfile for a service to reduce build time and image size.Problem statement: Given a suboptimal Dockerfile, improve it by minimizing layer sizes, reducing image bloat, and implementing best practices for performance.
FROM base_image:latest Base image to start from.
RUN ... Command that installs dependencies.
COPY ... Command that copies application code.
ENTRYPOINT ... Command that defines the startup behavior of the container.
Example 1: Input: Original Dockerfile has unnecessary dependencies and multiple RUN commands. Output: Optimized Dockerfile reduces layers and improves efficiency. Explanation: The optimized Dockerfile results in a smaller image with quicker build times.Constraints:
The Dockerfile must be compatible with Meta's CI/CD pipeline for container deployment.
Aim for an image size under 100MB.
codingHardci cd#4
4. [OA] Terraform State Management — Implement a system to efficiently manage states in Meta's CI/CD pipeline
In Meta's infrastructure, managing Terraform state is critical to ensure deployments are reliable and reproducible. Your task is to implement a minimal Terraform state management system that handles resource states.Problem statement: Write a class TerraformStateManager that keeps track of the state of various resources, allows updates to the state, and can retrieve states efficiently.
def __init__(self): Initialize the state manager.
def add_resource(self, resource_id: str, state: Any) -> None: Add or update a resource's state.
def get_resource(self, resource_id: str) -> Any: Retrieve the state of a specific resource.
Example 1: Input: manager = TerraformStateManager(); manager.add_resource('db_instance', {'status': 'running'}); state = manager.get_resource('db_instance') Output: {'status': 'running'} Explanation: The resource 'db_instance' is added and retrieved successfully.Constraints:
1 <= resource_id.length <= 100
The state is any valid JSON compatible Python data structure.
The resource state should handle at most 10^4 resources.