Category: String coding problemYou are given a list of label groups and a list of required labels. Each group is a list of strings. A group is considered valid if it contains every...Input: Array of strings Output: Array
codingMediumVerified Question#2
2. Region Grid Coloring
Category: Grid/matrix coding problemYou are given an M x N grid of security zones. Each cell contains one of the following values: - 1 -- the zone is cleared - 0 -- the zone...Input: 2D grid Output: Computed result
codingMediumVerified Question#3
3. Parallel Task Batching
Category: Graph coding problemA pipeline must execute a set of tasks with dependency constraints. Each dependency [A, B] means task A must complete before task B can start....Input: Graph (nodes and edges) Output: Computed result
codingMediumVerified Question#4
4. Maximum Interval Overlap
Category: Interval-based coding problemYou are given a list of closed intervals on the number line, where each interval [start, end] includes both endpoints. Find the maximum number of...Input: List Output: Integer
codingHardVerified Question#5
5. Interval Coverage Counter
Category: Interval-based coding problemGiven a list of closed intervals on the integer number line, build a data structure that efficiently answers point-coverage queries. A closed...Input: List Output: Computed result
codingEasyVerified Question#6
6. [CodeSignal] Movie Group Ranker
Category: Array coding problemYou are building a movie recommendation system. Given a source movie a user liked, you receive: - An array scores where scores[i] is the...Input: Array Output: Integer
codingEasyVerified Question#7
7. [CodeSignal] One-Hot Encoder
Category: Matrix coding problemGiven an integer array arr, return its one-hot encoded matrix as a 2D array. In a one-hot encoding: - Each row represents one element from arr. -...Input: Matrix (2D array) Output: Computed result
codingMediumVerified Question#8
8. Event Rate Limiter
Category: String coding problemDesign a rate-limited event logger for a streaming system. Events arrive in non-decreasing timestamp order. The system must suppress an event name if...Input: String Output: Printed output
codingMediumVerified Question#9
9. Viewing History Friends
Category: Algorithm coding problemA streaming platform groups customers together based on shared viewing habits. You receive: - customerIds - a list of distinct customer IDs -...Input: List Output: Array
codingHardVerified Question#10
10. Weight-Based Cache
Category: String coding problem# Weight-Based CacheInput: List Output: Computed result
system designSeniorapi design#1
1. [OA] Distributed Config Manager — design a configuration service for Netflix microservices
As Netflix manages a plethora of microservices, a central configuration manager is vital for managing dynamic configurations across deployments. Your task is to design a class that can handle storing, updating, and retrieving configurations for various services. - def get_config(service_name: str) -> Dict[str, str]: Retrieves configuration for a given service. - def set_config(service_name: str, config: Dict[str, str]) -> None: Updates the configuration for a given service. - def list_services() -> List[str]: Returns a list of all services currently managed by the configuration manager.Example 1: Input: set_config('video_service', {'quality': '1080p', 'bitrate': '4500kbps'}) Output: None Explanation: Updates the configuration for the video_service.Example 2: Input: get_config('video_service') Output: {'quality': '1080p', 'bitrate': '4500kbps'} Explanation: Retrieves the updated configuration for the video_service.Constraints: - The number of services managed does not exceed 1000. - Configuration items per service are limited to 100.
codingHardci cd#2
2. [OA] CI/CD Pipeline Automation — implement a CI pipeline for Netflix's streaming services
Netflix relies on seamless Continuous Integration and Continuous Deployment to ensure rapid iterations of their streaming services. You need to implement a pipeline that automatically tests and deploys code changes efficiently. Design a pipeline that includes automated testing, security scanning, and different deployment stages. - def run_tests(commit: str) -> None: Runs unit tests for the given commit. - def deploy_to_staging(commit: str) -> bool: Deploys the given commit to the staging environment. - def promote_to_production(commit: str) -> bool: Promotes a successfully tested commit to production.Example 1: Input: run_tests('abc123') Output: None Explanation: Runs all tests for the specified commit.Example 2: Input: promote_to_production('abc123') Output: True Explanation: Successfully promotes the commit to production if all tests passed.Constraints: - The commit string will be a valid git SHA. - Only valid commits that passed tests can be promoted.
codingHardinfra#3
3. [OA] Dockerfile Optimization — improve the build performance of Netflix microservices
As Netflix deploys thousands of microservices, optimizing Docker image builds is essential to reduce deployment times. You are tasked with refactoring a Dockerfile to enhance its efficiency. You need to rewrite the Dockerfile applying best practices in caching and layers to minimize build time while ensuring the image is as small as possible.Example 1: Input: Dockerfile with multiple RUN statements and unnecessary packages. Output: Optimized Dockerfile with fewer layers and reduced size. Explanation: Consolidates RUN statements and removes unnecessary dependencies.Constraints: - Current Dockerfile size is greater than 200MB. - Must maintain application functionality and compatibility.
codingHardinfra#4
4. [OA] Terraform State Management — automate the management of Terraform states for large-scale deployments
In Netflix's infrastructure, managing multiple Terraform states efficiently is crucial due to the vast number of services and environments. Proper state management ensures that the infrastructure is maintained consistently without manual errors. You are required to implement a script that automates the backup, cleanup, and restoration of Terraform states across different environments. - def backup_states(states: List[str]) -> None: Backs up the provided Terraform states. - def clean_old_states(states: List[str], retention_days: int) -> None: Cleans up states older than the specified retention period. - def restore_state(state: str) -> bool: Restores a Terraform state from the backup.Example 1: Input: backup_states(['dev', 'prod']) Output: None Explanation: Backs up the specified states.Example 2: Input: clean_old_states(['dev', 'prod'], 30) Output: None Explanation: Cleans up states older than 30 days.Constraints: - 1 <= states.length <= 100 - 1 <= retention_days <= 365