Loading practice problems…
Loading your practice workspace…
Loading code editor…
20 / 29
Sign in
Algorithms/Sorting

Largest Number

medium35 min

Arrange a list of non-negative integers so their decimal strings form the largest possible number.

Return the result as a string. If every value is zero, return a single zero.

Example 1

Inputnums = [10, 2]

Output"210"

Example 2

Inputnums = [3, 30, 34, 5, 9]

Output"9534330"

Constraints

  • 1 ≤ nums.length ≤ 100
  • 0 ≤ nums[i] ≤ 1,000,000,000
SortingCustom Comparator