Problem: https://mirror.codeforces.com/contest/1937/problem/B (Binary path)
int n; cin>>n;
string s,t; cin>>s>>t;
int count=1;
string path= s[0] + t;
string min_str= path;
for(int i=1; i<n; i++)
{
path[i]= s[i];
if(path < min_str){
count=1;
min_str= path;
}
else if(path == min_str)
count++;
}
cout<<min_str<<endl;
cout<<count<<endl;
I have written this coder sample for the above problem, but it keeps on getting TLE on Test 4. I can't seem to understand it because the time complexity for this is O(n) and n<=2.10^5 Can you explain in which part of my code is there an issue ? I want to use this current approach.