PracHub
QuestionsCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/NVIDIA

Compute the Final Robot Score

Last updated: May 19, 2026

Quick Overview

This question evaluates data structure and algorithm proficiency, focusing on managing dynamic multisets with priority-based selection and reasoning about iterative reductions and complexity.

  • easy
  • NVIDIA
  • Coding & Algorithms
  • Software Engineer

Compute the Final Robot Score

Company: NVIDIA

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

You are given an array `scores`, where `scores[i]` is the score of the `i`-th robot. Robots repeatedly compete using the following rules: 1. Select the two robots with the highest current scores, `x` and `y`, where `x >= y`. 2. These two robots compete. 3. If `x == y`, both robots are removed. 4. If `x > y`, the robot with score `y` is removed, and the robot with score `x` remains with a new score of `x - y`. 5. Repeat until at most one robot remains. Return the score of the final remaining robot. If no robots remain, return `0`. Design and implement an efficient algorithm. Analyze its time and space complexity. Example: ```text Input: scores = [2, 7, 4, 1, 8, 1] Output: 1 ``` Explanation: ```text 8 and 7 compete -> remaining score 1, scores become [2, 4, 1, 1, 1] 4 and 2 compete -> remaining score 2, scores become [2, 1, 1, 1] 2 and 1 compete -> remaining score 1, scores become [1, 1, 1] 1 and 1 compete -> both removed, scores become [1] Final score is 1 ```

Quick Answer: This question evaluates data structure and algorithm proficiency, focusing on managing dynamic multisets with priority-based selection and reasoning about iterative reductions and complexity.

Related Interview Questions

  • Merge Overlapping Time Intervals - NVIDIA (medium)
  • Return all file paths via DFS - NVIDIA (easy)
  • Implement a disk space manager with eviction - NVIDIA (medium)
  • Implement short algorithms on logs, grids, and strings - NVIDIA (hard)
  • Implement encode/decode for list of strings - NVIDIA (easy)
|Home/Coding & Algorithms/NVIDIA

Compute the Final Robot Score

NVIDIA logo
NVIDIA
May 19, 2026, 12:00 AM
easySoftware EngineerTechnical ScreenCoding & Algorithms
3
0
Practice Read
Loading...

You are given an array scores, where scores[i] is the score of the i-th robot.

Robots repeatedly compete using the following rules:

  1. Select the two robots with the highest current scores, x and y , where x >= y .
  2. These two robots compete.
  3. If x == y , both robots are removed.
  4. If x > y , the robot with score y is removed, and the robot with score x remains with a new score of x - y .
  5. Repeat until at most one robot remains.

Return the score of the final remaining robot. If no robots remain, return 0.

Design and implement an efficient algorithm. Analyze its time and space complexity.

Example:

Input: scores = [2, 7, 4, 1, 8, 1]
Output: 1

Explanation:

8 and 7 compete -> remaining score 1, scores become [2, 4, 1, 1, 1]
4 and 2 compete -> remaining score 2, scores become [2, 1, 1, 1]
2 and 1 compete -> remaining score 1, scores become [1, 1, 1]
1 and 1 compete -> both removed, scores become [1]
Final score is 1

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More NVIDIA•More Software Engineer•NVIDIA Software Engineer•NVIDIA Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.