Unable to identify issues
you should use the custom comparator approach,
int string::compare (const string& str) const
Returns:
0 : if both strings are equal.
A value < 0 : if *this is shorter than str or,
first character that doesn’t match is smaller than str.
A value > 0 : if *this is longer than str or,
first character that doesn’t match is greater
so for
1
10
23 5 5 29 4 294 9 1 2 4 50
it returns 50 before 5 which is wrong since clearly 550 is greater than 505 but 50 has greater length and hence it is returned before 5
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.