sir can you explain me how to sort array lexicographically
Biggest number from array
Lexicographically is the dictionary order,and in this question you aren’t supposed to do that.
You need to use your own comparator function. You want me to share the code?
No sir I don’t want code actually i am not getting how to sort lexicographically array so plz tell me that how to approach to solve it
Okay the comparator function looks like this
int myCompare(string X, string Y)
{
// first append Y at the end of X
string XY = X.append(Y);
// then append X at the end of Y
string YX = Y.append(X);
// Now see which of the two formed numbers is greater
return XY.compare(YX) > 0 ? 1: 0;
}