Hard · System Design
Find Servers That Handled Most Number of Requests
Given k servers numbered 0 to k-1 and requests with strictly increasing arrival times, where request i keeps its server busy from arrival[i] until arrival[i] + load[i] (the server is free again at that moment), send request i to the first free server at or after i mod k (wrapping around), or drop it if every server is busy; return the ids of all servers that handled the most requests, in any order.
Examples
Example 1
k=3 · 5 requestsOutput: [1]
Example 2
k=3 · exact release, wrap, tieOutput: [0,2]
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.