cswork / OA打开练习工作台

AgodaOA #2

Team Formation

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)前缀和区间贪心调度

Given n developers, each developer i is described by two values lowerSkill[i] and higherSkill[i], the range of skill levels they are willing to work at. A team operates at a single skill level; each developer must join one team whose level lies in their range. Find the minimum number of teams needed — equivalently, the maximum number of intervals overlapping at any single point.

Example 1

Input:

lowerSkill = [1, 3, 2, 2, 2]
higherSkill = [2, 2, 1, 1, 3]

Output:

3

Explanation: At skill level 2, four intervals overlap, but a partition of 3 teams (e.g., levels 1, 2, 3) covers everyone.