I was solving some problems and I found an interesting thing regarding the execution times on the server. If anyone could provide me with an explanation it would be amazing. Thanks :)
Here are the links to the submissions :
1 : 62ms
2 : 30ms
For those who didn't check the submissions here's what happened :
62ms code :
int n; cin>>n; cout<<3*n/2<<endl; return 0;
30ms code :
string str0,str1; cin>>str0>>str1; int cnt=0; str0+="$"; int len=str1.length(); REP(i,len) if(str1[i]==str0[cnt]) ++cnt; cout<<cnt+1<<endl; return 0;
}
No matter how I look at it the second code should have more exec time right?
Any help regarding this is highly appreciated.