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
codingHardgraph#1
1. [OA] Graph Traversal — Optimize genre recommendations for users
To enhance user experience and engagement, Netflix needs a system to recommend new content based on users’ viewing histories and preferences. It’s essential to identify connections between different genres and what combinations drive user engagement. Given a directed graph represented by an adjacency list where nodes represent genres and edges indicate recommended connections, implement a function to traverse the graph and return all genres reachable from the source genre in a list. - Implement getRecommendedGenres(genres: List[List[int]], start: int) -> List[int] which outputs all genres reachable from the start genre in any order.Example 1: Input: genres = [[1,2],[2,3],[3,4],[5],[]], start = 0 Output: [1, 2, 3, 4] Explanation: Starting from genre 0, we can reach genres 1, 2, 3, and 4 through multiple recommendations.Example 2: Input: genres = [[1,2],[],[3],[],[]], start = 1 Output: [] Explanation: Genre 1 has no further recommendations.Constraints: - 1 <= len(genres) <= 1000 - 0 <= genres[i].length <= 100
codingHardsliding window#2
2. [OA] Sliding Window — Track user viewing sessions in real-time
In a dynamic streaming platform like Netflix, understanding user engagement through the length of current viewing sessions is crucial for optimizing content delivery and recommendations. Given a list of int representing session durations where each duration is the time in seconds a user has spent watching content, return the maximum number of unique sessions in any continuous window of time. - You need to implement a function maxUniqueSessions(durations: List[int], k: int) -> int that returns an int representing the maximum number of unique sessions in any window of length k.Example 1: Input: durations = [1, 2, 3, 2, 4, 1], k = 4 Output: 4 Explanation: The unique sessions in the window of the last four durations are 2, 3, 4, 1, resulting in four unique sessions.Example 2: Input: durations = [3, 3, 3, 3, 3], k = 2 Output: 1 Explanation: All durations are the same; hence, the maximum unique sessions is 1.Constraints: - 1 <= len(durations) <= 10^5 - 0 <= durations[i] <= 10^5 - 1 <= k <= len(durations)