I was looking at this question on the usage of matrices in top down dynamic programming. In an attempt to apply it I tried the Longest Increasing Subsequence problem.
Looking at various implementations of the top down approach people seem to use a 1D array to memoize instead of a matrix. I thought the implementation would be a matrix where columns are the number of subproblems (which is the length of the array of numbers), and the number of rows would be the subset of remaining elements you can select from which at max would again be the length of the array of numbers - 1).
e.g.
dp = [[1] * len(nums) for i in range(len(nums))]
How do you know when to use a matrix vs. 1D array in dynamic programming?