In the compare function, we need to compare the lengths of the strings. So shouldn’t we use return a.length()<b.length in place of a<b.
because strings are character arrays so a and b should represent the base value of the respective arrays.
In the compare function, we need to compare the lengths of the strings. So shouldn’t we use return a.length()<b.length in place of a<b.
because strings are character arrays so a and b should represent the base value of the respective arrays.