Constraints:
1 <= T <= 100
1 <= M <= N <= 30000 (M and N size of 2 string)
Solution:
int main(){
fastIO;
ll t;
string s,a;
cin>>t;
ll xx = t;
while(t--){
cin>>s>>a;
ll ans = 0;
ll ss = s.size();
ll aa = a.size();
FOR(i,0,ss-aa+1){
FOR(j,0,aa){
if(a[j] == s[i+j]) ans++;
}
}
cout<<"Case "<<xx-t<<": "<<ans<<endl;
}
}
What is the time complexity of my code ? I got TLE on 5s. Can anyone please explain ?