You are given two servers and tasks of lengths n and m respectively. The value servers[i] represents the weight of the tasks[j] represents the time required to process the
Tasks are assigned according to the following rules:
At second j, the
While there are tasks in the queue and available servers, the task at the front of the queue is assigned to an available server that has the smallest weight. In the event of a tie, the server with the smallest index is chosen.
If no servers are available, the task remains in the queue until a server finishes its current task.
If multiple tasks are waiting in the queue when servers become available, they are processed in order of their arrival.
A server assigned task j at time t becomes free again at time tasks[j].
Return an array ans of length m, where ans[j] is the index of the server assigned to process the
Constraints:
servers.length
tasks.length
servers[i], tasks[j]
You are given two servers and tasks of lengths n and m respectively. The value servers[i] represents the weight of the tasks[j] represents the time required to process the
Tasks are assigned according to the following rules:
At second j, the
While there are tasks in the queue and available servers, the task at the front of the queue is assigned to an available server that has the smallest weight. In the event of a tie, the server with the smallest index is chosen.
If no servers are available, the task remains in the queue until a server finishes its current task.
If multiple tasks are waiting in the queue when servers become available, they are processed in order of their arrival.
A server assigned task j at time t becomes free again at time tasks[j].
Return an array ans of length m, where ans[j] is the index of the server assigned to process the
Constraints:
servers.length
tasks.length
servers[i], tasks[j]