class Solution {
public int[][] multiSearch(String big, String[] smalls) {
int[][] result = new int[100001][1001];
for(int i=0;i<smalls.length;i++){
List list = new ArrayList();
getIndex(big,smalls[i],0,list);
int[] count = (int[])list.toArray(new int[0]);
result[i] = count;
}
}
public void getIndex(String word,String target,int offset,List indexs) {
int index = word.indexOf(target,offset);
if(index != -1) {
indexs.add(index);
getIndex(word,target,index,indexs);
}
}
}
主要就是递归的indexOf找到字符在串所在位置