Problem · Greedy

Team Formation

Learn this problem
MediumAgodaINTERNOA

Problem statement

Given n developers, each developer i has:

  • lowerSkill[i]: max number of team members with skill less than theirs
  • higherSkill[i]: max number of team members with skill greater than theirs

Form the largest team such that every developer is okay with their relative skill positions.

Function

formLargestTeam(lowerSkill: int[], higherSkill: int[]) → int

Examples

Example 1

lowerSkill = [1, 3, 2, 2, 2]higherSkill = [2, 2, 1, 1, 3]return = 3
Agoda probably does not provide the explanation for the example...

More Agoda problems

drafts saved locally
public int formLargestTeam(int[] lowerSkill, int[] higherSkill) {
  // write your code here
}
lowerSkill[1, 3, 2, 2, 2]
higherSkill[2, 2, 1, 1, 3]
expected3
checking account