Open fvdcx opened 8 years ago
for (int i = 0; i < n; ++i) max_profit = max(max_profit, f[i] + g[i]); I think i would better range from 0 to n-1 [0, n-1) Because the case i = 0 and the case i = n -1 are the same.
for (int i = 0; i < n; ++i) max_profit = max(max_profit, f[i] + g[i]);
i
0
n-1
[0, n-1)
for (int i = 0; i < n; ++i) max_profit = max(max_profit, f[i] + g[i]);
I thinki
would better range from0
ton-1
[0, n-1)
Because the case i = 0 and the case i = n -1 are the same.