Menu

1606. Find Servers That Handled Most Number of Requests
šŸ“°

1606. Find Servers That Handled Most Number of Requests

DEV Community: phpĀ·MD ARIFUL HAQUEĀ·8 days ago
#J3DxQugb
#devto#dev#server#arrival#load
Reading 0:00
15s threshold

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).…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.