Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

my code for longest common pattern(Problem code: LCPESY)......it is showing TLE..plz plz any one help 4 dat..........

$
0
0

include<string.h>

include<stdio.h>

int main() { char a[10000],b[10000];

int t;

scanf("%d",&t);
  while(t>0)

{ int flag=0;

scanf("%s",&a);
scanf("%s",&b);
for(int i=0;i<strlen(a);i++)
{
    for(int j=0;j<strlen(b);j++)
    {
        if(a[i]==b[j]){
        flag++;
        b[j]='1';
        break;
      }
    }
}
printf("%d",flag);

t--;

}

}


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>