Form Biggest Number

You are provided an array of numbers. You need to arrange them in a way that yields the largest value.

please provide me the solution to this problem along with the comments so that I can understand it properly

hello @dhruvk3k
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.

for code pls check this->

if u still have any doubt then ping me back

do i need to learn vector to solve this problem

@dhruvk3k
no u can use array in place of vector .
both are very much similar

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.