Making call to op1

while making call to op1, op1 again gets converted to INT_MAX so how op1 value gets changed

Hey
See in every call, op1 is first set to INT_MAX, then op1 is set to minSteps(n/3, dp)+1 and this op1 contributes to the ans and ans gets returned to the call from where it was called.

if i use vector dp(n,0) instead of int dp[100] it is returning garbage value

no, it should work fine, can you share your code here so that i may help?

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.