Form biggest number

the code seems to work on the provided test case but is unable to pass any other test case . can u please have a look at the code.

ur code fails for
8
1 34 3 98 9 76 45 4
this i/p

required
998764543431

ur o/p
989764543431
also u forgot to add end line character

i can help u with the string based sorting approach
its easier and efficient

whats the string based method?

hey could u explain how the comparisons are being carried out in this case?

a combination of a+b and b+a must be checked and the greater needs to be returned

here a = 90 b = 9
a+b == 909
b+a == 990
hence 990 being the bigger one must be returned to form the biggest number
so
a+b > b+a
is returned since decreasing order is required

alright thank u so much

1 Like