You have to find the minimum length window in strDNA where strPAT is subsequence.
Example :
strDNA = “BANANA”
strPAT = “ANNA”
Here ANNA is sub-sequence of BANANA (click sub-sequence to understand sub-sequence).
Length is 5 ANANA contains ANNA.
There are several ways to check for occurrence of string as subsequence of another string.
Through DP we can find more efficient answer for minimum length.
Considering simple case I have written code to check whether strPAT is subsequence of strDNA or not.
Thanks to Dhaval for suggesting this approach and Article
#include <stdio.h>
main() {
char *x,*y;
int count=0;
int f=0;
char a[]=”anna”;
char b[]=”banana”;
x=a; y=b;
while(*y){
if(*x==*y){
x++;
f=1;
}
if(f==1)count++;
*y++;
}
if (*x!=’