Wine Problem DP

Here is my code for the bottom approach:

But it is taking O(N^3)
Please tell me what should I do to make it O(N^2)

Check the approach from here

I asked what is wrong in my code. I have already gone through the geeks for geeks solution. Didn’t understand it well that is why I asked the doubt

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.