I had made most of the changes still getting wrong o/p

correct it with comments

@kishoretaru
u cannot use set here
because they will not tell u the freq of occurance of a number

instead use 2 pointer approach
if both values are same add to string increment both pointers
if 1 value is less than other increment that arrays pointer
else the others

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.