This code is not giving correct output some output is correct like input 11 ans is outcoming wrong

Hello @balram,

The code you have written is logically incorrect.
Missing: You have to find the minimum number of steps.

I would suggest you to watch the video:CPP ★ Dynamic Programming | Reduce a number to one in minimum number of step (1-D DP) of your course.

Let me know if you don’t understand anything.

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.