How to approach memoization in a better way than I did I was solving a lC question which is this and the code I wrote is as follows: