In the Count Zero Request Servers interview question, you are given a set of logs representing requests sent to various servers. Each log contains a server ID and a timestamp. You are also given a series of queries, each representing a point in time . For each query, you must find the number of servers that did not receive any requests in the time interval , where is a fixed time window.
Companies like Amazon and Zomato ask the Count Zero Request Servers coding problem to evaluate a candidate's ability to handle time-series data and sliding window logic across multiple queries. It tests optimization skills: a naive approach would iterate through all logs for every query (O(Q * L)), but an efficient solution uses sorting and a sliding window to process queries in O(Q log Q + L log L).
This problem uses Sorting and the Sliding Window technique.
Total servers: 3. Window .
Logs: [[1, 3], [2, 6], [1, 7]] (Server, Time)
Query: . Interval: .
Whenever you have range-based queries on timestamps, sorting both the data and the queries is almost always the first step to an efficient solution.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Count Covered Buildings | Medium | Solve | |
| Distinct Numbers in Each Subarray | Medium | Solve | |
| Minimum Removals to Balance Array | Medium | Solve | |
| Sliding Subarray Beauty | Medium | Solve | |
| Maximum Sum of Almost Unique Subarray | Medium | Solve |