Algorithm to Solve Player Combination

Job ID: 34902374

Budget: $30 – $250 USD

Given an array of n Players, where each Player has a preference for exactly one of three roles (Attacker, Defender, or Healer), return one of the largest possible sets of legal teams of Players and their legal role assignments. In a legal solution, each team must have either one "Defender," one "Healer," and three "Attackers" or four "Healers" and one "Attacker." In a legal solution, each player assigned to a team must be assigned to exactly 1 role, and it must be their preferred role. In a legal solution, there can be at most n/5 teams.

Explaining concepts of time complexity analysis, space complexity analysis, algorithm design, and the analysis of algorithm correctness.