Comparator function?

What should be the comparator function for this one??

What you should do in compare function is that :
1.First check character by character until the length of smaller string. Return wherever you get unequal.
2.If all are equal, then return the string which is having larger length.

1 Like

You can have a look at this short code snippet to get idea.


You may mark the thread as resolved if you feel so :slight_smile:

1 Like