Simple C# solution


  • 0
    S
    public class Solution {
        public string LargestNumber(int[] nums) 
        {
            if(nums == null || !nums.Any())
                return string.Empty;
            Array.Sort(nums, (a,b) => string.Compare(b+""+a, a+""+b));
            return nums[0]==0? "0" : string.Join("", nums);
        }
    }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.