阿里面试题,求字符串的里重叠字符串,并装进一个数组 public static String[] findReduplication(String text) { int length = text.length(); String[] str = new String[length]; int count = 0; int i = 0, j = 0; for (; i < length - 1; i++) { for (j = i + 1; j < length; j++){ if(text.substring(i,i+1).equals(text.substring(j,j+1))) { continue; } else break; } if(j - i > 1){ str[count++] = text.substring(i,j); } i = j - 1; } String str1[] = new String[count]; for (int k = 0; k < count && str[k] != null; k++) { str1[k] = str[k]; } return str1; }