Problem · Array
Minimum Team Size From Every Start
Learn this problemProblem statement
Students stand in a fixed order. talent[i] is an integer from 1 through talentsCount.
For every starting index, choose a consecutive group beginning there that contains every talent at least once. Return the minimum possible group length for each start, or -1 when the remaining suffix cannot form a complete team.
Function
teamSize(talent: int[], talentsCount: int) → int[]Examples
Example 1
talent = [1,2,3,2,1]talentsCount = 3return = [3,4,3,-1,-1]The shortest complete windows starting at the first three positions have lengths 3, 4, and 3. The last two suffixes miss at least one talent.
Constraints
1 <= talent.length, talentsCount <= 2000001 <= talent[i] <= talentsCount
More Atlassian problems
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024