You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for(int i=0;i<=sum;i++)
t[0][i]=0;
t[0][0]=1;
for(int i=1;i<=n;i++){
for(int j=0;j<=sum;j++){ // j=0 works for above case though I was not able to find the exact reason for same
if(arr[i-1]<=j)
t[i][j]=t[i-1][j] + t[i-1][j-arr[i-1]];
else
t[i][j]=t[i-1][j]%m;
}
}
The text was updated successfully, but these errors were encountered:
for : count_of_subsets_with_given_sum.cpp (https://github.com/shubhamchemate003/Dynamic-Programming-Questions-by-Aditya-Verma/blob/main/count_of_subsets_with_given_sum.cpp)
is failing for
Working Code :
The text was updated successfully, but these errors were encountered: