Algorithm · Capital One · Medium
Simulate a round-robin group of servers. Send each package to the next server that still has capacity, bypassing servers that have been shut down and cycling back to the beginning when needed. Return the largest server index among those that processed the greatest number of packages. Example Input: servers: [1, 5, 0], packages: 5 Output: 1 The first server can process one package, the third server is unavailable, and the remaining four packages go to server 1. Therefore,…
Checking your access…