Exceeding memory limit on some test cases


This is the link for my code.

On submission it is showing that I am exceeding the memory limit on some test cases.
Could you help me figure out what is it that I am doing wrong here

hello @sankalp.sharma99
becuase ur dp array is taking too much memory.
declare it of size 1005 X 1005 it will work.

It is given that the N value can be as large as 10^6.
So , shouldn’t my dp array be big enough to accommodate that.

Also, I am getting wrong answer on submitting after changing the dimensions for the dp array

sorry bro i have checked some different problem.

use linear dp for this problem.

refer this -> https://www.geeksforgeeks.org/coin-change-dp-7/

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.