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