Conceptual doubt in string

bool myCompare(string a, string b) {
if (a.find(b)==0 || b.find(a)==0)
return a.length() > b.length();
return a < b;
}

Help me understand this!

hey @ashish_meher, out of string array, if any string is present the in another string than string are sorted in dec order of there length. Otherwise, they are sorted in increasing order(not length but according to characters).

1 Like

hey @ashish_meher , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved

1 Like