Showcase C# code (4 lines can get it done)


  • 5
    B

    Do not get me wrong I am working with Java

    internal static string LargestNumber(List<int> vals)
        	{
        		if(vals==null || vals.Count==0)
        			return "";
        		vals.Sort((a,b)=>String.Compare(b+""+a,a+""+b));
        		return vals[0]==0?"0":String.Join("",vals);
        	}

Log in to reply
 

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