Vivek loves array game why we need to use dp?

i can’t able to under stand where subproblems are recomputed .
my recursion code: https://ide.codingblocks.com/s/240448

@dhruv.160410116084,
Why do you think we don’t need dp, do you think it can be done greedily or using divide and conquer?

if we find a pivot point then we call for left side of it and right side of it, i can’t able to see overlapping subproblems.

@dhruv.160410116084,
Exactly, and that’s why we would use recursion, but not memoization.

so i tried with recursion but i get tle

If you have tried with recursion and got a tle just memoize the points and you’ll be able to save your time. Hence no TLE.

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.