check my code please and help me
Wrong answer please help
@saurabhvit
Save your code on ide.codingblocks.com and send me the link so that i can help you with it.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
string replace(string s,int id)
{
if(s.length()<=1){
return s;
}
string res = replace(s,id);/// this will lead to infinite recursion because you are calling for same thing again and again
if(s[0]==‘p’ && res[0]==‘i’){
return res.substr(0,id) + “3.14” + res.substr(id+2);
}
else{
return res;
}
}
modified code is:https://ide.codingblocks.com/s/229051
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.