Form Biggest Number
hi sudhanshu. your code gives wrong output because of the wrong logic. you are sorting the strings in reverse order and then joining them to form the largest no. lemme give you an example where this approach wont work.
suppose you have 2 strings 54 and 542
so u sort them in reverse order, and get 542 54 , so your output will be 54254, but this is not the largest no which could be formed. u can form 54542 as the largest no.
ok mam,I understood now.
shall i mark the doubt as resolved?
Yes,mam
My doubt has resolved.
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.