Rod cutting problem(recursion +bottom up dp)

in max_profit() for i=2 how the function will progress
, as for n<=0 , 0 will be returned so according to this , in case of i=2 ans should be 24 , but over all ans is 22 , make me clear please

Hey @kabirsachin1999
First thing there are 2 different examples in case u are getting confused because of that

Other thing Please share the timestamp from where u are not able to understand :slight_smile:

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.