I want to know for a problem say LCS, we can reduce space complexity for a dp solution because when we are filling the table in dp we just use either dp[i - 1][j] or dp[i][j - 1] to fill dp[i][j] as instead of having a dp table of size m X n.
We can solve this using dp[2][n] and switch states states while calculating. Can this be possible with memorization to reduce space complexity to O(n + m)?