NeetCode #541LC-1882MediumHeap / Priority Queue
← Back to All Problems#541 · #1882 · Process Tasks Using Servers(使用服务器处理任务)
📌 Problem Statement & Constraints
You are given
servers (where servers[i] is the weight of server i) and tasks (where tasks[j] is the time to process task j). Task j arrives at time j. A free server is chosen by smallest weight, then smallest index; if none is free, the task waits for the earliest available. Return the server index assigned to each task. Constraints: 1 <= n, m <= 2 * 10^5.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!