Practice Find Servers That Handled Most Number of Requests
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Find Servers That Handled Most Number of Requests
Problem Statement
There are k servers numbered 0 through k - 1, each able to process one request at a time. Request i arrives at arrival[i] and occupies its server for load[i] time units. Assign it to the first free server found by scanning cyclically from i % k; drop it if every server is busy. Return all server ids with the greatest number of handled requests, in any order.
Source: Find Servers That Handled Most Number of Requests on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
k = 3, arrival = [1,2,3,4,5], load = [5,2,3,3,3]
[1]
# Example 2
k = 3, arrival = [1,2,3,4], load = [1,2,1,2]
[0]
# Example 3
k = 3, arrival = [1,2,3], load = [10,12,11]
[0,1,2]
Constraints
Related LeetCode Problems
Practice more problems similar to Find Servers That Handled Most Number of Requests.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.