FastPrepLargest Number
Problems/Largest Number

Largest Number

LinkedIn logoLinkedIn● MediumNEW GRADPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: The interview report identifies the canonical largest-concatenated-number exercise.

Given an array of nonnegative integers nums, arrange them so that their decimal representations form the largest possible number.

Return the result as a string. If every number is zero, return "0".

Function

largestNumber(nums: int[]) → String

Examples

Example 1

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

Placing 2 before 10 produces the larger concatenation.

Example 2

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

Ordering by pairwise concatenation places 9, 5, 34, 3, then 30.

Constraints

  • 1 <= nums.length <= 100
  • 0 <= nums[i] <= 1000000000

More LinkedIn problems

  • Explore an Unknown Grid and Find a PathONSITE INTERVIEW · Seen Nov 2026
  • Fire Station Response BillONSITE INTERVIEW · Seen Nov 2026
  • Sum an Arbitrary-Dimensional ArrayPHONE SCREEN · Seen Oct 2026
All LinkedIn interview questionsSee LinkedIn hiring insights
Saved
class Solution {
    public String largestNumber(int[] nums) {
        // Write your code here
    }
}
Checking account…