Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

A distributed system has m processing nodes and an integer array task, where task[i] identifies the type of the ith task. Equal values represent separate tasks of the same type.

Assign a subset of the tasks to the nodes while following these rules:

  • Every node receives the same number of tasks.
  • A node receives at most one task of each type.
  • Each task instance is assigned to at most one node.
Test Cases
Input
Output
Expected