Defeat 100% in java
Note: The  community solution have this method: str.split();\nsplit use regex expression. reg take much time, dont use it if you can.\n\n\n        public String
Note: The  community solution have this method: str.split();\nsplit use regex expression. reg take much time, dont use it if you can.\n\n```\n        public String[] reorderLogFiles(String[] logs) {\n\n            final int n = logs.length;\n            String[] res = new String[n];\n            int pLet = 0;\n            int pDig = n - 1;\n            for (int i = n - 1; i >= 0; --i) {\n                String log = logs[i];\n                char first = log.charAt(log.indexOf(" ") + 1);\n                if (first >= \'0\' && first <= \'9\') {\n                    res[pDig--] = log;\n                } else {\n                    res[pLet++] = log;\n                }\n            }\n\n            Arrays.sort(res, 0, pLet, new Comparator<String>() {\n                public int compare(String log1, String log2) {\n                    int index1 = log1.indexOf(" ");\n                    int index2 = log2.indexOf(" ");\n                    return log1.substring(index1).compareTo(log2.substring(index2));\n                }\n            });\n\n            return res;\n        }\n\n```\n\n
[]