double R(int N, int x[206], int i, int c){
if (memo[i][c] != 0) return memo[i][c];
if (i==N){
if (c>=23) return 1;
else return 0;
}
double s;
s = R(N,x,i+1,c+x[i]);
s += R(N,x,i+1,c-x[i]);
memo[i][c] = s;
return s;
}
Right now this is a recursive memoized function but I want to translate this to iterative equivalent DP if possible. Or is this the only way I can do it?