i am getting segmentation fault through this code.please check and guide. here is my code
Optimal game strategy-||
@aditikandhway, you are declaring dp matrix again in your function , also initialize dp with -1 or some negative number as a[i] can be 0 so in case we have an array of large size and with value 0 then it will not be memoized also there is some error in the mentioned size of array it should be 5000, so change the size of dp to 5000 x 5000 , else you will get MLE (Memory limit exceeded)
corrected code :- https://ide.codingblocks.com/s/314859
Okay. I got that. thank you!!