C# Solution (accounts for unstable sort)
I love C#, but it did let me down with this problem! I had not realized that both Array.Sort() and List.Sort() are only stable for small collections. Source her
I love C#, but it did let me down with this problem! I had not realized that both Array.Sort() and List.Sort() are only stable for small collections. Source [here](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.sort?view=netcore-3.1).\n\nSo I changed my algo to:\n1. Separate strings and digits\n2. Sort strings with comparer\n3. Append digits\n4. Return as array\n\n```\n\npublic class Solution {\n    private class LogComparer : IComparer<string>\n    {\n\n        public int Compare(string x, string y)\n        {\n            var xParts = x.Split(\' \');\n            var yParts = y.Split(\' \');\n\n            var xSort = x.Substring(xParts[0].Length + 1);\n            var ySort = y.Substring(yParts[0].Length + 1);\n\n            if (xSort.Equals(ySort))\n                return xParts[0].CompareTo(yParts[0]);\n            else\n                return xSort.CompareTo(ySort);\n        }\n    }\n\n    List<string> _letterLogs = new List<string>();\n    List<string> _digiLogs = new List<string>();\n\n    public string[] ReorderLogFiles(string[] logs)\n    {\n\n        for (int i = 0; i < logs.Length; i++)\n        {\n            var parts = logs[i].Split(\' \');\n            if (char.IsDigit(parts[1][0]))\n                _digiLogs.Add(logs[i]);\n            else\n                _letterLogs.Add(logs[i]);\n        }\n\n        _letterLogs.Sort(new LogComparer());\n        _letterLogs.AddRange(_digiLogs);\n\n        return _letterLogs.ToArray();\n    }\n\n}\n\n```
[]