Exchange coins problem code issue

https://ide.codingblocks.com/s/62265 please point my mistake this code is working fine in my macbook please suggest me the changes

Hi Neeraj, pls declare the vector in main as below instead of declaring it globally.

vector< long long int >sum(n,0) //After you input n;

this summons your line 5, 28, 29, 30

And change the function header to:

long long int max(long long int n,vector &sum)

It will work fine now :slight_smile: