I first wrote a function to find the first digit of each array element but don’t know how to solve the rest.
Not getting the logic of the problem
Hi Ashutosh
The logic to this problem Biggest number is 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 142 and 60. To compare X and Y, we compare 14260 and 60142. Since 60142 is greater than 14260, we put Y first.
I Hope you understand the logic and if you still face any issue Please let me know.!
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.