1606. Find Servers That Handled Most Number of Requests
Difficulty: Hard
Topics: Principal , Array , Heap (Priority Queue) , Simulation , Ordered Set , Biweekly Contest 36
You have k servers numbered from 0 to k-1 that are being used to handle multiple requests simultaneously. Each server has infinite computational capacity but cannot handle more than one request at a time . The requests are assigned to servers according to a specific algorithm:
The iįµŹ° (0-indexed) request arrives.
If all servers are busy, the request is dropped (not handled at all).
If the (i % k)įµŹ° server is available, assign the request to that server.
Otherwise, assign the request to the next available server (wrapping around the list of servers and starting from 0 if necessary).ā¦