i dont know y my test case is wrong
Biigest number error test case
@yatin hey yatin please work with this case
1
8
1 34 3 98 9 76 45 4
your output is
989764543431
but expected output is
998764543431
yes sir
what should i do so that 9is given priority over 98
??plzz clear my doubt sir
sir i got my answer correct
but how does this logic works
xy.compare(yx)>0
@yatin hey yatin
A simple solution that comes to our mind is to sort all numbers in descending order, but simply sorting doesn’t work. For example, 548 is greater than 60, but in output 60 comes before 548. As a second example, 98 is greater than 9, but 9 comes before 98 in output.
So how do we go about it? The idea is to use any comparison based sorting algorithm. In the used sorting algorithm, instead of using the default comparison, write a comparison function myCompare() and use it to sort numbers. Given two numbers X and Y, how should myCompare() decide which number to put first – we compare two numbers XY (Y appended at the end of X) and YX (X appended at the end of Y). If XY is larger, then X should come before Y in output, else Y should come before. For example, let X and Y be 542 and 60. To compare X and Y, we compare 54260 and 60542. Since 60542 is greater than 54260, we put Y first.
