#179

Largest Number

specialist · 975 · lc medium +32 · verified · 42.7% accepted · 9,423 likes · top 24%

play →

Description

Given a list of non-negative integers nums, arrange them to form the numerically largest possible number and return it as a string (since the result may be very large).

Example 1:

Input: nums = [10,2]
Output: "210"

Example 2:

Input: nums = [3,30,34,5,9]
Output: "9534330"

Code

1
2
3