Simple java solution using custom comparator 100% faster
class Solution {\n\n    public String[] reorderLogFiles(String[] logs) {\n        List digitList = new ArrayList<>();\n        List letterList = new ArrayList<>
class Solution {\n\n    public String[] reorderLogFiles(String[] logs) {\n        List<String> digitList = new ArrayList<>();\n        List<String> letterList = new ArrayList<>();\n        String[] res = new String[logs.length];\n\n        for(String s : logs) {\n            if(Character.isAlphabetic(s.charAt(s.length()-1))) letterList.add(s);\n            else digitList.add(s);\n        }\n        letterList.sort((s1,s2) -> {\n            int a = s1.indexOf(" ");\n            int b = s2.indexOf(" ");\n            String temp1 = s1.substring(0, a);\n            String temp2 = s2.substring(0, b);\n            \n            String toSort1 = s1.substring(a+1);\n            String toSort2 = s2.substring(b+1);\n            return toSort1.equals(toSort2) ? temp1.compareTo(temp2) : toSort1.compareTo(toSort2);});\n\n        int i = 0;\n        for(String s : letterList) res[i++] = s;\n        for(String s : digitList) res[i++] = s;\n\n        return res;\n    }\n\t\n}
['Java']