I have an array of random numbers lets say:
[10,11,12,14,15,16,17,18,19,20, 11, 12, 14,25,25,26,27,28,29]
I have to detect repeated sequences (witch are in fact errors)
with length bigger then a specific number (2).
Is there any good algorithm for this ?
what I have for now:
int minLenght = 3;
int[] data = {1,2,3};
for(int i = 0; i < data.length; i++){
for(int j = 0; j < data.length; j++){
if ( data[i] == data[j]){
int l = 0;
int ii = i;
int jj = j;
while(data[ii] == data[jj]){
ii++;
jj++;
l++;
}
if(l >= minLenght){
print('['+i+'-'+ii+'] same as ['+j+'-'+jj+']');
}
}
}
}