Quiz doubts how is this b ans

@guptashubham210a, according the code snippet, the comparator is defined as follows :-
-> if s1 size is less than s2 size than s1 is placed before s2
-> if s2 size is less than s1 size than s2 is placed before s1
-> if sizes of s1 and s2 is same , than we place them based on lexiographical order

so string of size 1 will be placed first lexiographically which will be
a b c

string of size 2 will be placed than i.e.
xy

string of size 3 will be placed than i.e.
abc bca

In case of any doubt feel free to ask :slight_smile:
Mark your doubt as RESOLVED if you got the answer

string xy is at last na after a ,b ,c abc and bca will be compared so then bca and xy so final ans should be
a,b,c,abc,xy,bac?

abc has a length of 3 so it can’t be placed before xy as it has length 2,
the comparator function sorts based on increasing length of string and lexiographically for same length strings

got it .THanks alot.

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.