Question Link : https://www.spoj.com/problems/MIXTURES/
My Solution : https://ide.codingblocks.com/s/73871
I am getting wrong answer plz help.
Wrong Answer Spoj Mixtures
@shubham_joshi hey shubham update your main function as
int main() {
int n ;
cin>>n;
// cout << n ;
for(int i=0 ; i<n ; i++)
{
cin >> a[i] ;
}
for(int i=0 ; i<=n ; i++)
{
for(int j = 0 ; j<=n ; j++)
{
dp[i][j] = -1 ;
}
}
cout << solve_mixtures(0,n-1) << endl;
}
Why does the code give runtime error if we remove the memoization steps and just try and submit it recursively ?