Not able to pass all the test cases
hello @dipeshpandey2001
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;
}
not able to write the code for it
pls check this->
not understood this part>>bool compare(string &a,string &b) { return a+b>b+a; },>>how will it directly compare if ab is greater ob ba
have u studied comparator in sorting?
no not clear about it ,havent studied and its not there in the course also.
it is probably covered in ur stl playlist
have u finised ur stl section?
no it is after 3 or 4 sections i guess,
will watch it,and will ask you again if i have doubt,thanks)
ok i am closing this thread, u can raise new doubt if u get any issue in this.
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.