Answer : http://ide.geeksforgeeks.org/TIe2ve

my answer is coming correct in devc++ but in GeeksForGeeks it is showing segmentation fault

Question : http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/

Answer : http://ide.geeksforgeeks.org/TIe2ve

my answer is coming correct in devc++ but in GeeksForGeeks it is showing segmentation fault

Question : http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/

Your code isnt following input format.

It clearly says-

- In each test cases, the first line contains an integer ‘M’ denoting the size of array
- The second line contains M space-separated integers A1, A2, …, AN denoting the elements of the array.
- The third line contains an integer ‘N’ denoting the cents.

But you are taking input as-

```
int v,n;//Assuming v is value?
cin>>v>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
```