How i will take 10000*10000 dp matrix?

this question is giving compilation error when taken this size array and by simple reccursion it is TLE

problem : https://leetcode.com/contest/weekly-contest-186/problems/maximum-points-you-can-obtain-from-cards/

my sol :

this is solution : https://ide.codingblocks.com/s/275918

hello @ssanjuchandra
that big size dp array is not possible.

btw u dont need dp for this problem.

first compute prefix and suffix sum array.
and then find max value of prefix[i]+suffix[k-i] .
refer this-> explanation .

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.