Count Players Who Level Up
Updated
Problem statement
At the end of a game round, each player has a score. A player's rank is 1 plus the number of players with a strictly higher score. Equal scores share a rank, and later ranks skip the tied positions.
Return how many players can level up: their score must be greater than 0 and their rank must be at most k. A player with score 0 never levels up.
Function
numPlayers(k: int, scores: int[]) → intExamples
Example 1
k = 3scores = [100,50,50,25]return = 3The ranks are [1,2,2,4]. The first three players have rank at most 3 and positive scores.
Example 2
k = 1scores = [80,80,0]return = 2Both players with score 80 have rank 1, so both qualify. The player with score 0 cannot level up.
Example 3
k = 4scores = [0,10,0,5]return = 2The scores 10 and 5 have ranks 1 and 2. Both zero-score players are excluded even though their rank is 3.
Constraints
1 <= scores.length <= 10^50 <= scores[i] <= 1001 <= k <= scores.length
More Adobe Online Assessment questions
- Base Unit ConversionsOA · Seen Nov 2026
- Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
- Top-Funded Villages and ProjectsOA · Seen Aug 2026
- Count Parent Nodes With a Target SumOA · Seen Aug 2026
- Largest Binary Number by ConcatenationOA · Seen Aug 2026
- Count Events by CategoryOA · Seen Aug 2026
- Graph M-ColoringOA · Seen Aug 2026
- Hall of Shifting TilesOA · Seen Aug 2026
- K-th Ancestor Subtree Preorder QueryOA · Seen Aug 2026
- Maze ReachabilityOA · Seen Aug 2026
Similar questions at other companies
- Build the Task HierarchyPendo · OA
- Closest NumbersHeadlands Technologies · OAHeadlands Technologies interview questions
- Count Numbers Not Equal to the First TwoAirbnb · OAAirbnb interview questions
- Picked Player Who LostSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
- REST API: Country CodesHackerRank · OAHackerRank interview questions
- Macaron Order with Set DiscountsShopify · OAShopify interview questions
- Lowest Number in an Open RangeCapital One · OACapital One interview questions
- Missing IntervalsIBM · OAIBM interview questions
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
Adobe interview experiences
- Adobe New Grad OA: Unit Conversion and Code Review: 1 Experience
- Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
- Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
- Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
- Adobe New Grad MTS Interview Questions: 7 Experiences
- Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)