Minimum steps bottom up approach in dp

please refer the video which is mentioned in the time he explained the code and show us the output , but in this video it show for 5 it will take 4 steps , how is it possible??, is this video code is wrong, the correct output for 5 is 3

because for 5 , first we decrease 1 son it become 4 (1 step)
from 4 divide by 2 and it becomes 2 (1step) and from 2 again divide by 2 (1step) soo overall steps are 3 , so why this code is showing 4 steps , send me the correct code of this video , ASAP

Hey @shashank_sabharwal

dp[i]=dp[i-1]+1;
if(i%2==0)dp[i]=min(dp[i],dp[i/2]+1);
if(i%3==0)dp[i]=min(dp[i],dp[i/3]+1);

This should be the correct way

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.