sde
Interview Date
21-08-2026
Result
Selected
Difficulty
Easy
Rounds
01
Drive Type
Off-Campus
Topics asked
Detailed experience
## Question 1: API Endpoint Rate Limiting Concepts:** Sliding Window, Hash Map Problem Statement:** You are given an array of integers `requests` representing the IDs of API endpoints accessed in a sequence, and an array of integers `weights` of the same length representing the priority score of each request. You are also given an integer `limit`. Find a contiguous subarray of requests such that no endpoint ID appears more than `limit` times within the subarray. Return the maximum possible sum of the `weights` corresponding to such a valid subarray. Test Case:** *Input:** `requests = [1, 2, 1, 3, 2]`, `weights = [10, 20, 30, 40, 50]`, `limit = 1` *Output:** `120` *(The subarray from index 2 to 4 gives requests `[1, 3, 2]` which has all unique IDs, with a weight sum of 30 + 40 + 50 = 120)* - ## Question 2: Target Average Utilization Concepts:** Prefix Sum, Hash Map, Mathematics Problem Statement:** You are given an array of integers `cpu_usage` representing the CPU load percentage at consecutive time intervals, and an integer `target_avg`. Your goal is to find the longest contiguous block of time (subarray) where the exact arithmetic average of the CPU usage values within that block is strictly equal to `target_avg`. Return the length of this longest contiguous subarray. If no such subarray exists, return `0`. Test Case:** *Input:** `cpu_usage = [2, 5, 3, 6, 2, 8]`, `target_avg = 4` *Output:** `4` *(The subarray `[5, 3, 6, 2]` has a sum of 16 and a length of 4, yielding an average of exactly 4)* - ## Question 3: Minimum Segment Complexity Concepts:** Sliding Window, Hash Map Problem Statement:** You are given an array of integers `tasks` where each integer represents a specific type of background process, and an integer `k`. You must isolate a contiguous subarray of exactly length `k`. The "complexity score" of a subarray is defined as the number of **distinct** task types present in the subarray multiplied by the **maximum frequency** of any single task type within that same subarray. Return the minimum possible complexity score among all contiguous subarrays of length `k`. Test Case:** *Input:** `tasks = [1, 2, 1, 3, 2, 2]`, `k = 3` *Output:** `3` *(The subarray `[2, 1, 3]` at index 1 has 3 distinct elements [1, 2, 3] and a max frequency of 1. Complexity = 3 * 1 = 3. Other subarrays like `[1, 2, 1]` have 2 distinct elements and max frequency 2, yielding a complexity of 4)*