Simply apply dp and getting this werror
Getting wired error
@Akshay123,
Firstly you can/should not make that big array, your dp array size is 10^5*10^5=10^10 Bytes = 1GB, mostly no online judge will provide you that much memory, everyone has to manage resources.
Also why do you have [m] in your dp as state, it does not even change, recall, a dp state has to identify the subproblem uniquely, but in your code [m] state is same for all subproblems, so why is it even a state.
It same as saying co-ordinates in 1D can be represented by {x,0}, where -inf<x<inf, which is a redundant information, rather you can simply say co-ordinates in 1D can be represented by x.(Like number line)
Thanks man , very helpful
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.