← 返回 scale.ai 的题目列表轻量 Load Balancer
类型:online_judge
Design a lightweight load balancer with the following features: 1. Maintain a worker state machine represented by a priority queue to track worker load status; 2. Support dynamic scaling up and down of worker numbers; 3. Implement a time-bound complete code with necessary testing. Provide a performance analysis of the code, including the time and space complexity.
Example
Input
add_worker(1)
add_worker(2)
assign_task()
complete_task(1)
remove_worker(1)