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
Implement a Message Queue to manage the flow of streaming requests, ensuring reliability and performance under load. The queue should accommodate multiple producers and consumers. Problem statement: Create a MessageQueue class with the following methods: - push(message: str): add a message to the queue. - pop() -> str: retrieve a message from the queue. - size() -> int: return the current queue size.Example 1: Input: push('First message') Output: size() -> 1 Explanation: A message was added to the queue.Constraints: - 1 <= message.length <= 100 - Queue operations must be thread-safe.
system designMediumapi design#2
2. [OA] RateLimiter — control the rate of requests to streaming
Design a rate-limiting service for Netflix's API to prevent abuse and provide smooth customer experiences. Implement a class-based rate limiter that allows a specific number of requests in a given time window. Problem statement: Create a RateLimiter class with the following methods: - is_request_allowed(user_id: str, timestamp: int) -> bool: returns True if request is within the limit and False otherwise. - put_request(user_id: str, timestamp: int): logs a request.Example 1: Input: user_id = 'user1', timestamp = 1 Output: True Explanation: User makes a request at timestamp 1.Constraints: - 1 <= user_id <= 10000 - timestamp >= 0.
codingHarddynamic programming#3
3. [OA] Longest Increasing Subsequence — User engagement over time
Netflix seeks to maximize content engagement. Code a function to find the longest increasing subsequence of user engagement scores over days. Problem statement: Given an integer array representing daily engagement scores, determine the longest subsequence that is strictly increasing.Example 1: Input: engagement = [3, 10, 2, 1, 20] Output: 3 Explanation: The longest increasing subsequence is [3, 10, 20].Constraints: - 1 <= engagement.length <= 1000 - 0 <= engagement[i] <= 10^4.
codingHardgraph#4
4. [OA] Dijkstra's Algorithm — find the shortest path for movie recommendations
Netflix needs to quickly connect users to the best matching content. Implement an algorithm to find the shortest path based on user preferences and genre ratings. Problem statement: You have a graph represented as an adjacency list where nodes are movies and edges represent user ratings (cost). Write a function that returns the shortest path from a starting movie node to the target movie node.Example 1: Input: graph = {"A": {"B": 1, "C": 4}, "B": {"C": 2, "D": 6}, "C": {"D": 3}, "D": {}} Output: A -> B -> C -> D Explanation: The shortest path from A to D is through B and C.Constraints: - 1 <= length of graph <= 100 - 0 <= rating <= 100.