FastPrepLargest Number by Concatenation
Problems/Largest Number by Concatenation

Largest Number by Concatenation

NVIDIA logoNVIDIA● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an NVIDIA phone screen for a new grad role. The report gives the goal of joining numbers into the largest result, with the example [3,54,5] giving 5543. We chose nonnegative values, how zero is written, and finite limits. Running time was not required.

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

Given a nonempty array nums of nonnegative integers, choose an order for all its items so that concatenating their decimal representations produces the largest possible number.

Use each occurrence exactly once. Return the concatenation as a string because it may exceed a fixed-width integer. If all items are zero, return "0".

Function

largestNumber(nums: int[]) → String

Examples

Example 1

nums = [3,54,5]return = "5543"

The numbers are ordered as 5, 54, then 3.

Example 2

nums = [10,2]return = "210"

Placing 2 before 10 gives 210 rather than 102.

Example 3

nums = [3,30,34,5,9]return = "9534330"

The pairwise concatenation order is 9, 5, 34, 3, 30.

Constraints

  • 1 <= nums.length <= 100.
  • 0 <= nums[i] <= 10^9.

More NVIDIA Phone Screen questions

  • Network Layer Execution OrderPHONE SCREEN · Seen Nov 2026
  • Paged KV Cache AccessPHONE SCREEN · Seen Nov 2026
  • Sliding Window Attention over a KV CachePHONE SCREEN · Seen Nov 2026
  • Summarize Server Healthcheck LogsPHONE SCREEN · Seen Oct 2026
  • Hash Partition OffsetsPHONE SCREEN · Seen Oct 2026
  • Filter Paginated Medical RecordsPHONE SCREEN · Seen Oct 2026
  • Least Frequently Used CachePHONE SCREEN · Seen Oct 2026
  • Parallel String Counts with a Custom Hash TablePHONE SCREEN · Seen Oct 2026
  • Simulate a Reference-Counted Smart PointerPHONE SCREEN · Seen Aug 2026
  • Streaming Top-K Frequent ElementsPHONE SCREEN · Seen Aug 2026

Similar questions at other companies

  • Fair Capped Money DistributionGusto · PHONE SCREEN · ONSITE INTERVIEWGusto interview questions
  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
  • Remove the Fewest Magic BeansThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Aggressive CowsAmazon · PHONE SCREEN
  • Minimize Range After Three ChangesDRW · PHONE SCREENDRW interview questions
  • Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
  • Experiment Bucket Allocation and RebalancingPinterest · PHONE SCREENPinterest interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
  • Minimum Appointment Cancellations with a Required BreakMaven Clinic · PHONE SCREENMaven Clinic interview questions

NVIDIA interview experiences

  • NVIDIA Full-Time SWE Onsite Scheduling: 1 Experience
  • NVIDIA OA: What It Tests (2026)
  • NVIDIA DevOps, QA and Infra Intern Interviews: 12 Experiences
  • NVIDIA Ignite Internship OA Experience
  • NVIDIA Software Intern Interview Questions: 9 Experiences
  • NVIDIA Ignite SWE Intern OA Questions: 6 Experiences
All NVIDIA interview questionsSee NVIDIA hiring insights
Saved
class Solution {
    public String largestNumber(int[] nums) {
        return "";
    }
}
Checking account…