Problem Link so, I was able to come up with memoization approach, but unable to write iterative version.
The correct one happens to be
But I failed to realise, why this one is wrong.
could u help me out please, any kind of help on how to approach such iterative DP problems, will be appreciated.