For biggest number from array

can this question be made for smallest possible number
without leading zeros and input can be zero if yes then how can we solve using comparators or any other way

Hey @talhashamim001
yes we can just reverse the inequality in comparison
i.e

bool lexi( string s1,string s2)
{
	return s1+s2<s2+s1;
}

but how to deal with zero like if we get input 0 12 13 23 then we can’t have 0121323 because leading zero is not allowed

and please can you explain why s1>s2 is not working in all test case and s1+s2>s2+s1 is working fine in all test cases

Remove all 0 initially and place them after 1st number after sorting like I told

Say we have 653 and 65361
Now we will place 653 first and 65361 later
why because 65361653<65365361

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.