Big sorting hackerrank solution in C#
int n = Convert.ToInt32(Console.ReadLine()); string[] a = new string[n]; for (int i = 0; i < n; i++) a[i] = Console.ReadLine(); Array.Sort(a, (left, right) => { if (left.Length != right.Length) return left.Length - right.Length; else return string.CompareOrdinal(left, right); // left.CompareTo(right) is too slow }); for (int i = 0; i < n; i++) Console.WriteLine(a[i]);