Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Largest Number

XPChallenge Points: 20
levelLevel: Medium

You are given a list of non-negative integers, nums.
Your task is to arrange the numbers such that they form the largest possible number when concatenated together.
Since the final result may be extremely large, you must return it as a string, not as an integer.
The goal is to determine the optimal order of the numbers so that their combined string representation is the maximum possible.

Example 1:

Input: nums = [8, 80]

Output: "880"

Example 2:

Input: nums = [12, 121]

Output: "12121"

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result