Class Solution

java.lang.Object
g0101_0200.s0179_largest_number.Solution

public class Solution extends Object
179 - Largest Number.<p>Medium</p> <p>Given a list of non-negative integers <code>nums</code>, arrange them such that they form the largest number.</p> <p><strong>Note:</strong> The result may be very large, so you need to return a string instead of an integer.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> nums = [10,2]</p> <p><strong>Output:</strong> &ldquo;210&rdquo;</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> nums = [3,30,34,5,9]</p> <p><strong>Output:</strong> &ldquo;9534330&rdquo;</p> <p><strong>Example 3:</strong></p> <p><strong>Input:</strong> nums = [1]</p> <p><strong>Output:</strong> &ldquo;1&rdquo;</p> <p><strong>Example 4:</strong></p> <p><strong>Input:</strong> nums = [10]</p> <p><strong>Output:</strong> &ldquo;10&rdquo;</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= nums.length <= 100</code></li> <li><code>0 <= nums[i] <= 10<sup>9</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • largestNumber

      public String largestNumber(int[] nums)