here is my code >>> https://ide.codingblocks.com/s/476008
Sir, where i am doing mistake?
hello @r_kumar_17
sorting lexicographical order will not ensure maximum .
for example->
1
2
2 21
correct output is 221 but urs will give 212.
the logic is if a and b are two numbers then u can combine them in two ways either ab or ba right?
which ever combination give us maxium we will consider that order.
so just apply same logic in ur comparator and sort using this comparator
bool cmp(string a,string b){
return a+b > b+a;
}
check this->
ok sir, thank you . sir i have a doubt . please visit this code >>> https://ide.codingblocks.com/s/476030
cin treats space as delimiter , so it will always skip space.
since u already know number of string all u have to do is
a)run a loop n time
b)red string using cin
for(int i=0;i<n;i++) cin>>a[i];