Kindly help in debugging

I am unable to understand for which edge cases the program is not working.

@2304ambikagupta_35a5bee93bbf353e since order also matter while printing. Maintain an increasing order when you’re printing values. For example :
15
12 10 17 22 20 85 74 38 23 64 46 51 65 99 87
10 12 17 20 22 23 38 46 51 64 65 74 85 87 99
1
20 2
This should give
17 85
but your code is giving
85 17

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.