Please help me with code

please tell the error or approach or code

@adarshsingh2k which question?

form biggest number in arrays

@adarshsingh2k what approach you used, i think you have sent the wrong code

i tried to use next permutation to get the gratest number

@adarshsingh2k no the correct approach is
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.
c++ editorial code for reference(first try yourself then see)


dont forget to hit like and mark resolved if cleared :smiley:

just a small doubt what dose this imply string XY = X.append(Y); string YX = Y.append(X); return XY.compare(YX) > 0 ? 1: 0;

@adarshsingh2k xy mein x+y aajayegi and yx mein y+x (plus ka matlab append)
phir compare kar rahe hai agar uss hisab se sort

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.