using an index along with function call helps. which can be further memorized. Check Coin Change II problem