FastPrepNumber of Players (for MTS2)
Problems/Number of Players (for MTS2)

Number of Players (for MTS2)

Nutanix logoNutanix● EasyFULLTIMEOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

A group of friends are playing a video game together. During the game, each player earns a number of points. At the end of a round, players who achieve at least a certain rank k get to "level up" their characters to gain increased abilities. Given the scores of the players at the end of a round, how many players will be able to level up?

Note: Players with equal scores will have equal ranks, but the player with the next lower score will be ranked based on the position within the list of all players' scores. For example, if there are four players, and three of them tie for first place, their ranks are 1, 1, 1, and 4.

Note: No player with a score of 0 can level up, regardless of rank.

Function

numPlayers(k: int, scores: int[]) → int

Complete the function numPlayers in the editor.

numPlayers has the following parameters:

  1. 1. k: the cutoff rank to level up a player's character
  2. 2. scores[n]: the players' scores

Returns int: the number of players who can level up after this round

Examples

Example 1

k = 3scores = [100, 50, 50, 25]return = 3

These players' ranks are [1, 2, 2, 4]. Because the players need to have a rank of at least k = 3 to level up, only the first three players qualify. Therefore, the answer is 3.

Example 2

k = 4scores = [20, 40, 60, 80, 100]return = 4

The players achieve the ranks [5, 4, 3, 2, 1] in order. Since the cutoff k, is rank >= 4, there are 4 players who can level up.

Example 3

k = 4scores = [2, 2, 3, 4, 5]return = 5

The players achieve the ranks [4, 4, 3, 2, 1] in order. Since the cutoff rank is 4, all 5 players can level up.

Constraints

  • 1 ≤ n ≤ 10^5
  • 0 ≤ scores[i] ≤ 100
  • k ≤ n

More Nutanix interview questions

  • Print FooBar AlternatelyPHONE SCREEN · Seen Nov 2026
  • Design Hit CounterONSITE INTERVIEW · Seen Oct 2026
  • Peak Process MemoryONSITE INTERVIEW · Seen Aug 2026
  • Good SubsequencesOA · Seen Jul 2026
  • Min Cost to Connect All PointsOA · Seen Jun 2026
  • Minimum Operations to Transform ArrayONSITE INTERVIEW · Seen Jun 2026
  • Count Connected Components in an Undirected GraphONSITE INTERVIEW · Seen Aug 2025
  • Digit Changes for a Multiple of 9OA · Seen Aug 2025
  • Gas Station Loop StartOA · Seen Aug 2025
  • LRU CacheONSITE INTERVIEW · Seen Aug 2025

Similar questions at other companies

  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • Build the Task HierarchyPendo · OA
  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Competition Winner and Runner-Up (Forward Deployed Engineer)Boston Consulting Group · OABoston Consulting Group interview questions
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Rank Football TeamsCapital One · OACapital One interview questions
  • Maximum Apples That Fit in a BoxVirtu Financial · OAVirtu Financial interview questions
  • Rank Football TeamsPersona · OAPersona interview questions
  • Meandering ArrayVerisk · OA

Nutanix interview experiences

  • Nutanix interviews · November 2026
  • Nutanix SWE Intern Phone Screens: 20 Experiences (Part 3 of 3)
  • Nutanix SWE Intern OA Questions: 16 Experiences (Part 2 of 3)
  • Nutanix U.S. SWE Intern Interviews: 54 Experiences (Part 1 of 3)
  • Nutanix SWE OA and Interviews, Level Not Reported: 9 Experiences
  • Nutanix Intern Debugging Round and Interviews: 25 Experiences
All Nutanix interview questionsSee Nutanix hiring insights
Saved
class Solution {
    public int numPlayers(int k, int[] scores) {
      // write your code here
    }

}
Checking account…