Calvins's Game Hint

So
dpf[] = dpf[j] + max[dpf[i-1], dpf[i-2]]
and
dpb[i] = … is the bottoms up approach right .
But I don’t understand the last relation

ans = max (ans , dpf[i] +dpb[i] - a[i] ) , what will be ans here ? please do mark any reference links if possible.

Better Solution
Refer this -:

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.