forward phase:
dpf[i] = max ( arr[i+1]+func(i+2,j) , arr[i+2]+func(i+3,j) )
backward phase:
dpb[i]=max( arr[i-1]+func(i-2,j) ,arr[i-2]+func(i-3,j) )
at the end we can return dpf[k]+dpb[k]
in the backward case i am traversing in reverse direction