https://ide.codingblocks.com/s/232784 plz check this code wrt https://cses.fi/problemset/task/1636/,,, im getting segmentation fault, and im not able to figure out error!!! plz help
Minimum Coin Change
@Bhavya_Goel Hey the arises because of the size of array you are creating.
First thing are creating an 2D array of 100 * 1000000 That is 10^8 (also same will be your time to run which will again give tle)an array of this size will lead to segmentation fault as normally their is not this much resources allocated to one program on IDEs. Second when ever creating large array create them dynamically using new/malloc, or create them as global variable.
If this resolves your doubt mark it as resolved.
so how should i fix my current program
@Bhavya_Goel Create arrays globally, and create array according to constraints, For this problem mostly constraints are 100 coins, sum 1000 or 10000. So make array of size 100*1000.
If this resolves your doubt mark it as resolved,
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.