one testcase is not working
I have used functors to solve the problem
One test case is showing run-error in String Sort challenge
bool compare(string a,string b)
{
for(int i=0;i<min(a.length(),b.length());i++)
{
if(a[i]<b[i])
return true;
if(a[i]>b[i])
return false;
}
return a.length()>b.length();
}
You just need to make this sort helper function.
Compare each charater and return if mismatch . In case both same, return bigger length wala first
bool compare(string a,string b)
{
for(int i=0;i<min(a.length(),b.length());i++)
{
if(a[i]<b[i])
return true;
if(a[i]>b[i])
return false;
}
return a.length()>b.length();
}
You just need to make this sort helper function.
Compare each charater and return if mismatch . In case both same, return bigger length wala first
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.