Hey why only one test case is passing
@adarshsingh2k hey your compare logic is incorrect.
if(a.size() <= b.size() && b.substr(0 , a.size()) == a) return false;
else if(b.size() <= a.size() && a.substr(0 , b.size()) == b) return true; else return a<b;
what did you do can you please explain
if a string is present completely as a prefix in another string, then string with longer length should come first. Eg bat, batman are 2 strings and the string bat is present as a prefix in Batman - then sorted order should have - Batman, bat.
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.