Minimum Team Size From Every Start
Updated
Problem 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 Online Assessment questions
- 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
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- API Rate Limit Violation DetectionTekion · OATekion interview questions
- Count Subarrays With Product Equal to KSalesforce · OASalesforce interview questions
- Garden Sprinkler PlacementAirbnb · OAAirbnb interview questions
- Sliding-Window Means with IEEE Special ValuesHeadlands Technologies · OAHeadlands Technologies interview questions
- Earn the Most 🐝Capital One · OACapital One interview questions
- Count Belt Sections With K Fruit Pairs (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
- Count Servers With No Requests in a Time WindowIBM · OAIBM interview questions
- Reschedule Meetings for Maximum Free TimeFivetran · OAFivetran interview questions
- Count Subarrays with at Least K Equal-Fruit PairsTikTok · OATikTok interview questions
- Consistent LogsRippling · OARippling interview questions