// 暴力解法 if (strs.length == 0) { return ""; } if (strs.length == 1) { return strs[0]; } if (strs[0].equals("")) { return ""; } int n = strs.length; StringBuffer sb = new StringBuffer(); int j = 0; ouur: while (true) { char t = strs[0].charAt(j); for (int i = 0; i < n; i++) { if (j >= strs[i].length()) { break ouur; } if (t == strs[i].charAt(j)) { if (i == n - 1) sb.append(t); } else { break ouur; } } j++; if (j >= strs[0].length()) { break; } } return sb.toString();