FastPrepAssign Tasks to Servers
Problems/Assign Tasks to Servers

Assign Tasks to Servers

Amazon logoAmazon● EasyOA

Updated Sep 2026

QuestionFunctionExamples

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

Interview reports that mention this question

  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Recent Reports (Part 4 of 5)
  • Amazon New Grad OA Problems: Every Task We Have (Part 3 of 5)
See Amazon hiring insights
Saved
class Solution {
    public int[] assignTasks(int servers, int[] requests) {
      // write your code here
    }

}
Checking account…