Load Balancer

Problem Overview

  • Implement a load balancer assigning each request to the available server with the smallest index, else return -1; availability follows arrival and burst time windows.
  • Inputs: n servers, arrival[m], burstTime[m]; Output: int[m] with server indices per request.
  • Constraints: 1≤n,m≤1e5, times up to 1e9; if multiple requests arrive together, the lower request index is processed first.
  • Real-world context: round-robin style load balancing in distributed systems; a coding interview problem and interview question from TikTok interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: