public class Solution { public string LargestNumber(int[] nums) { var nodes = new List(); for(var i = 0;i < nums.Length; i++){ nodes.Add(new Node(nums[i])); } var list = nodes.OrderByDescending(x=>x); var s = string.Join(,list); if(s[0] == '0'){ return 0; } return s; } public class Node : IComparable { public int val; public Node(int v) { val = v; } public override string ToString() { return val.ToString(); } public int CompareTo(object obj) { var n2 = obj as Node; var n1 = this; var s1 = n1.ToString(); var s2 = n2.ToString(); if (s1[0] < s2[0]) { return -1; } else if (s1[0] > s2[0]) { return 1; } var v1 = s1 + s2; var v2 = s2 + s1; var i = 0; while (i < v1.Length) { if (v1[i] < v2[i]) { return -1; } else if (v1[i] > v2[i]) { return 1; } i++; } return 0; } } }