why is it giving wrong answer in maxprofitDP function
2D wine problem DP
Hey @Vibhuti0206
There’s a little mistake in your code of maxprofitDP function:
1.) In the for loop written by you:
for(int len=2;len<=2;len++){
The above is wrong. Here you need to run the loop from 2 till n. So write the loop correctly as:
for(int len=2;len<=n;len++){
2.) Also in your cout statement:
cout<<<<setw(3)<<dp[i][j]<<" ";
The above is wrong.
Write it as:
cout<<setw(3)<<dp[i][j]<<" ";