Java - Nothing Fancy, 15 lines, 2ms, all clear.
Updating this with non-bs variable names because once you get hired you will absolutely hate people who use cryptic names.\n\nmy solution takes advantage of wha
Updating this with non-bs variable names because once you get hired you will absolutely hate people who use cryptic names.\n\nmy solution takes advantage of what we\'re guaranteed in the problem:\n1. guaranteed to have a word following an identifier (allows me to use indexOf \' \' freely).\n2. letter logs need to be ordered lexicographically, so we can use built in compare function when we know we have two.\n3. number logs need to be sorted naturally, so we just say they\'re all "equal" to eachother and trust java\'s built in sort feature to be stable.\n4. number logs need to be after letter logs, so once we find out they\'re different, we return one of the other and short-circuit.\n```\npublic String[] reorderLogFiles(String[] logs) {\n        \n        Comparator<String> myComp = new Comparator<String>() {\n            @Override\n            public int compare(String s1, String s2) {\n                int s1SpaceIndex = s1.indexOf(\' \');\n                int s2SpaceIndex = s2.indexOf(\' \');\n                char s1FirstCharacter = s1.charAt(s1SpaceIndex+1);\n                char s2FirstCharacter = s2.charAt(s2SpaceIndex+1);\n                \n                if (s1FirstCharacter <= \'9\') {\n                    if (s2FirstCharacter <= \'9\') return 0;\n                    else return 1;\n                }\n                if (s2FirstCharacter <= \'9\') return -1;\n                \n                int preCompute = s1.substring(s1SpaceIndex+1).compareTo(s2.substring(s2SpaceIndex+1));\n                if (preCompute == 0) return s1.substring(0,s1SpaceIndex).compareTo(s2.substring(0,s2SpaceIndex));\n                return preCompute;\n            }\n        };\n        \n        Arrays.sort(logs, myComp);\n        return logs;\n    }\n```
[]