Loading the task…
This is how simple load balancers work: the first task goes to the first server, the next task to the second server, and so on in a cycle. Given the number of tasks tasks and the number of servers servers, return a list of length tasks showing which server index handles each task. Server indices go from 0 to servers - 1. If there are no tasks, return an empty list.
5, 2[0, 1, 0, 1, 0]0, 3[]3, 3[0, 1, 2]def round_robin(tasks, servers):
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in5, 2[0,1,0,1,0]0, 3[]3, 3[0,1,2]4, 1[0,0,0,0]7, 3[0,1,2,0,1,2,0]1, 3[0]