educative.io

Not optimal memoisation solution

The solution uses three indexes mIndex , nIndex , and pIndex, however, pIndex has always be the sum of the first two. So pIndex is redundant and the solution can be simplified. You can also see that the tabulation solution only uses two indexes as well.

1 Like