FastPrepNutanix Sports Meet
Problems/Nutanix Sports Meet

Nutanix Sports Meet

Nutanix logoNutanix● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The screenshots show the full task from a Nutanix online test for 2021 summer interns.

The original input holds several races and prints one count for each. Here you get one race as m, position and speed, and you return its count. The original allows up to 10^5 runners. Here the limit is 5 * 10^4 so that one test can reach it. All other limits are the same as in the original.

Our version is about 90% the same as the reported question.

It is sports day at Nutanix. The runners, called nutants, race along a one-lane road to a finish line that is m miles from the start of the road.

Runner i starts position[i] miles along the road and runs toward the finish at its top speed of speed[i] miles per hour. Nobody can pass the runner in front. When a runner catches up with the runner or group ahead, it stays right behind them, and from then on they all move together at the speed of the group in front.

A nugang is a group of one or more runners at the same position moving at the same speed. A runner on its own is also a nugang. A runner that catches up with a group exactly at the finish line finishes as part of that group.

Return the number of nugangs that reach the finish line.

Function

countNugangs(m: int, position: int[], speed: int[]) → int

Examples

Example 1

m = 12position = [10,8,0,5,3]speed = [2,4,1,1,3]return = 3

The runners at miles 10 and 8 both need 1 hour to finish, so the runner from mile 8 reaches the runner from mile 10 right at mile 12. They finish as one nugang.

The runner from mile 3 is faster than the runner at mile 5. After 1 hour both are at mile 6, so they move on together at speed 1 and finish at hour 7.

The runner from mile 0 also has speed 1. It needs 12 hours and never catches anyone, so it finishes alone.

That makes 3 nugangs.

Example 2

m = 20position = [0,6,10]speed = [3,3,1]return = 1

The runner from mile 6 catches the runner at mile 10 after 2 hours, at mile 12. From then on that group moves at speed 1.

The runner from mile 0 has the same speed as the runner from mile 6, so it could never catch that runner alone. But after 2 hours it is at mile 6, 6 miles behind the slowed group, and it gains 2 miles per hour. It joins the group 3 hours later, at mile 15.

Everyone finishes together, so the answer is 1.

Example 3

m = 7position = []speed = []return = 0

No runners take part, so no nugang reaches the destination.

Constraints

  • n == position.length == speed.length
  • 0 <= n <= 5 * 10^4
  • 0 < m <= 10^6
  • 0 < speed[i] <= 10^6
  • 0 <= position[i] < m
  • All values in position are different.

More Nutanix Online Assessment questions

  • Good SubsequencesOA · Seen Jul 2026
  • Min Cost to Connect All PointsOA · Seen Jun 2026
  • Digit Changes for a Multiple of 9OA · Seen Aug 2025
  • Gas Station Loop StartOA · Seen Aug 2025
  • Number of Players (for MTS2)OA · Seen Oct 2024
  • Work Schedules (for MTS2)OA · Seen Oct 2024
  • Minimum Operations to Convert ArrayOA · Seen Apr 2024
  • No Adjacent CharactersOA · Seen Apr 2024
  • Build a BST From a ListOA · Seen Nov 2022
  • Delete Even-Valued Nodes From a Linked ListOA · Seen Nov 2022

Similar questions at other companies

  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Minimum Cost K-Capable ModelsMicrosoft · OAMicrosoft interview questions
  • Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
  • Maximize Minimum Deployment DifficultyJP Morgan Chase · OAJP Morgan Chase interview questions
  • Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
  • Maximize Center A Package BenefitAmazon · OA
  • EV Charging Cost OptimizationTata Consultancy Services · OATata Consultancy Services interview questions
  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions

Interview reports that mention this question

  • Nutanix SWE OA and Interviews, Level Not Reported: 9 Experiences
  • Nutanix Intern Debugging Round and Interviews: 25 Experiences

Nutanix interview experiences

  • 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)
All Nutanix interview questionsSee Nutanix hiring insights
Saved
class Solution {
    public int countNugangs(int m, int[] position, int[] speed) {
        // Write your code here.
    }
}
Checking account…