Can't figure out why my code is not working

This is the link to my code— https://ide.codingblocks.com/s/333531
Please help me out in finding where my code is going wrong

Watch out for taking mod with 0 (p may become 0)
Also try another approach, as this one seems incorrect.

Please help me out with this. I’m not able to figure out a way to do this…
And also can you please help me find out where exactly my approach is going wrong…
Here is a link to another approach that I tried to implement for this question — https://ide.codingblocks.com/s/333833

Alright Ayush, so first let’s think what can be done for 2 numbers:
99 and 98,
first option is 9998 and second is 9899, obviously first one is better, so now consider 3 or more numbers and you will see that it boils down to normal sorting problem where comparison between two numbers is judged on concatenation.
To be more precise if concat(a,b)>concat(b,a) then a should come before b.
Try to code it.

This is the link to my code – https://ide.codingblocks.com/s/334849 . I’m getting correct output for all test cases that I tried to pass. It’s still not getting submitted. Do we need to integer as a single entity instead of like what I did in which I just printed the array elements without any spaces such that it represented the final required output

My bad, the code is not giving correct output. Please discard that. Also I’m not able to understand the method you were talking about(regarding concatenation), can you please elaborate?

take input the numbers as strings(instead of int), after that sort the array with custom provided compare function(talked of earlier),
then simply output the array without spaces!

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.