Please tell me where i am going wrong

String Sort problem


Here is the code…

hi @Shorya-Sharma-1269737519832469
the compare function is wrong
check both things, whether a is a substring of b
or whether b is a substring of a

if both of these are false then sort lexicographically

but i have also made another compare function which checks which string is bigger and then i am computing the substring…

@Shorya-Sharma-1269737519832469 do a dry run of your program, that will not work .
As you can see from the sample input also this logic is not correct

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.