In bottom up approach what are we exactly doing in line no 31 . arr[j] + dp[i-j] . how are we breaking down the problem . suppose n = 3 so, we need to get ans from n=0 , n=1 , n=2. and the add the arr[3] in it and find the maximum.
why are we not using arr[i]+dp[i-j] .