I am constantly getting “Memory Limit Exceeded” for my top-down approach with memoization.
I changed my int 2D array to a bool 2D array but I am still facing this problem. I am getting an ok for correctness, so I don’t think my solution is wrong.
A little help would be appreciated as I cannot come up with a better solution using less than O(n^2) space!
Thanks in advance!!