this is the link to my code please help
Please help in the code finding one problem
Check now
can you please explain what you have done in the code???
please reply
ya sure,
if(a.size() <= b.size() && b.substr(0, a.size())==a){
return a.size()>=b.size();
}
else if(b.size() <= a.size() && a.substr(0, b.size())==b){
return a.size()>=b.size();
}
This part of the code is ensuring that
When you get two strings such that one string can come under another string like bat came in batman. In this case we will print batman first and then bat.
So expected output is:
batman
bat
and this part of the code
else{
return a<b;
}
is for lexicographical ordering.
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.