Java: Small (NLogN)
\nclass Solution {\n    public String[] reorderLogFiles(String[] logs) {\n        if(logs.length <=0) return logs;\n        List<String> letterL = new ArrayList
```\nclass Solution {\n    public String[] reorderLogFiles(String[] logs) {\n        if(logs.length <=0) return logs;\n        List<String> letterL = new ArrayList<>();\n        List<String> digL = new ArrayList<>();\n        for (String str : logs) {\n            String[] sList = str.split(" ");\n            if(Character.isDigit(sList[1].charAt(0))) {\n                digL.add(str);\n            } else {\n                letterL.add(str);\n            }\n        }\n        Collections.sort(letterL, (a, b) -> {\n            String s1 = a.substring(a.indexOf(" ") + 1);\n            String s2 = b.substring(b.indexOf(" ") + 1);\n            return s1.equals(s2) ? a.compareTo(b) : s1.compareTo(s2);\n        });\n        letterL.addAll(digL);\n        return letterL.toArray(new String[letterL.size()]);\n    }\n}\n```
[]