Python, using only heaps
Solution using three heaps. First heap is used to quickly free up the nodes. Then we split the servers to those that come after the server_id which is current s
Solution using three heaps. First heap is used to quickly free up the nodes. Then we split the servers to those that come after the `server_id` which is current server and those that come before, for loopback.\n```\ndef busiestServers(self, k: int, arrival: List[int], load: List[int]) -> List[int]:\n\tbusy_jobs = []  # heap (job_end_time, node) to free up the nodes quickly\n\tafter = [] # heap (nodes) free after current server\n\tbefore = list(range(k))  # heap (nodes) to use for loopback\n\trequests_handled = [0] * k\n\n\tfor i, (arrvl, ld) in enumerate(zip(arrival, load)):\n\t\tserver_id = i % k\n\t\tif server_id == 0:  # loopback\n\t\t\tafter = before\n\t\t\tbefore = []\n\n\t\twhile busy_jobs and busy_jobs[0][0] <= arrvl:\n\t\t\tfreed_node = heapq.heappop(busy_jobs)[1]\n\t\t\tif freed_node < server_id: heapq.heappush(before, freed_node)\n\t\t\telse: heapq.heappush(after, freed_node)\n\n\t\tuse_queue = after if after else before\n\t\tif not use_queue: continue  # request dropped\n\t\tusing_node = heapq.heappop(use_queue)\n\t\trequests_handled[using_node] += 1\n\t\theapq.heappush(busy_jobs, (arrvl + ld, using_node))\n\n\tmaxreqs = max(requests_handled)\n\treturn [i for i, handled in enumerate(requests_handled) if handled == maxreqs]\n```
['Heap (Priority Queue)', 'Python', 'Python3']