Top down dp Doubt

When i am solving any DP problem using Recursion+memorisation and its a 2D DP question with constraints as first element can be upto 10^5 and second is upto 10^2 the when i am passing my array/vector to the function for memorisation or declaring dp array/vector globally then it is showing runtime error and all test cases are passed

but if constraints are less then it worked fine

also please tell me how to solve large constraint questions using top down dp

plz reply ASAP

@sengarankit98 hey that depend on constraint of question ,usually in dp question constraints are such that if you take 2d dp it will pass, also usually dp array is passed as argument of function as declaring it globally will create problem ,also it you can use map in place of 2d array. It depend on you how to solve it.

It means we can not use top down dp in large constraints? and plz tell me the safe contraints upto which i can use TOP DOWN DP with no complications
also if we use map the we have to find an entry in o(n)

@sengarankit98 hey we can use top down in large constraints if there is no TLE. similiarly with bottom up.We take 2D array in both approaches so there is upper limit on constarints of 2D array if you take more than that it will give run time error. 10 ^5 is upper constraint.In map you can simply use find function it will help.

Thank u
It really helped

And one more thing what is the maximum size of array declared inside function?

@sengarankit98 hey welcome, usually you can take 10 ^ 6 size array in function or normally anywhere in prgramme.

Thanks brother for solving the doubts and also replying fast.

@sengarankit98 no problem, anytime bro please close this doubt and give rating if you are satisfied.