Count Valid Teams
Updated
Problem statement
You are given an integer array skills, where each value is one player's skill level. A player is eligible when their skill is between lowerBound and upperBound, inclusive.
A team is any subset of eligible players containing at least minPlayers players. Players are distinct even when they have equal skill values.
Return the exact number of valid teams. If fewer than minPlayers players are eligible, return 0.
Function
countValidTeams(skills: int[], minPlayers: int, lowerBound: int, upperBound: int) → longExamples
Example 1
skills = [1,2,3]minPlayers = 2lowerBound = 1upperBound = 3return = 4All three players are eligible. There are three two-player teams and one three-player team.
Example 2
skills = [4,8,5,6]minPlayers = 2lowerBound = 7upperBound = 8return = 0Only the player with skill 8 is eligible, so no team can contain two players.
Example 3
skills = [1,2,3,4]minPlayers = 1lowerBound = 2upperBound = 3return = 3Two players are eligible. Their two singleton teams and the team containing both are valid.
Constraints
1 <= skills.length <= 60.-10^9 <= skills[i] <= 10^9.1 <= minPlayers <= skills.length.-10^9 <= lowerBound <= upperBound <= 10^9.
More Wells Fargo Online Assessment questions
- Server Upgrade PlanningOA · Seen Nov 2026
- Student and Course EnrollmentOA · Seen Nov 2026
- Bond Interest Summary Above 3%OA · Seen Oct 2026
- Count Phrases Formed by Anagram ReplacementOA · Seen Oct 2026
- Event Statistics AggregatorOA · Seen Sep 2026
- Ordered Deployment Configuration ValidatorOA · Seen Sep 2026
- Longest Subsequence That Is a SubstringOA · Seen Jul 2026
- Overloaded Game Account InventoriesOA · Seen Jul 2026
- Count Server ReplacementsOA · PHONE SCREEN · Seen Feb 2026
- Minimum Remaining LengthOA · PHONE SCREEN · Seen Feb 2026
Similar questions at other companies
- Get Triplet CountIBM · OAIBM interview questions
- Sum of Pipeline Response TimesBloomberg LP · OABloomberg LP interview questions
- Count Reverse-Digit PairsVisa · OAVisa interview questions
- Get Triplet CountPoint72 · OAPoint72 interview questions
- Product of Subset MaximaArcesium · OAArcesium interview questions
- Find Maximum Number of Balanced CombinationsAmazon · OA
- Counting Triplets Divisible by DAT&T · OAAT&T interview questions
- Paint Fence Work SplitNutanix · OANutanix interview questions
- Next Pascal Row CoefficientIntuit · OAIntuit interview questions
- Minimum Operations to Flip Exactly K BitsGoogle · OAGoogle interview questions