Assign Tasks to Servers
Updated
Problem statement
You have an integer servers, which denote the number of servers, and you have a list called requests which denote the servers that this request is allowed to be scheduled to. You have to schedule each request to a server among servers 0 to requests[i] (inclusive) such that it is the least busy server. If multiple servers are the least, use the one with the least index. Return a list containing the server where each request was served.
Function
assignTasks(servers: int, requests: int[]) → int[]Examples
Example 1
servers = 5requests = [3, 1, 0, 2, 1]return = [0, 1, 0, 2, 1]N/A
More Amazon interview questions
- Lexicographically Largest IdentifierOA · Seen Nov 2026
- Assign Escalations to TeamsONSITE INTERVIEW · Seen Nov 2026
- Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Nov 2026
- Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
- Maximum Earnings Across WarehousesONSITE INTERVIEW · Seen Nov 2026
- Priority Message BufferONSITE INTERVIEW · Seen Nov 2026
- Search in a Rotated Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent ElementsOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fill One Exact-Length Binary WindowOA · Seen Nov 2026
Similar questions at other companies
- Build a Max HeapRippling · OARippling interview questions
- Apply Binary State OperationsZipRecruiter · OAZipRecruiter interview questions
- Minimum Cost to Merge Values into OnePayPal · OAPayPal interview questions
- Maximum ScoreNVIDIA · OANVIDIA interview questions
- Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
- Team FormationDoorDash · OADoorDash interview questions
- Meeting Rooms IIWise · OA
- Maximum Server Processing TimeVisa · OAVisa interview questions
- Rearrange Songs by AuthorZomato / Eternal · OAZomato / Eternal interview questions