I used Top Down DP as (NNT>10^8 in bottom up) . But still i am getting tle. Please Help .
Link to code
https://ide.geeksforgeeks.org/kHGwqyYdpx
Time limit exceeded
I used N=16000 and not N=17000 because of space constraint of dp array
@shreyas_that,
My Implementation:
You don’t need to memoise the recursion, there are no overlapping subproblems.
Thanks a lot sir …