Is it possible to reduce the memory to O(N*M) for recursive top down DP solution?


  • 0
    C

    I can code the top down DP solution in O(NM string length) time and space but worst case memory limit is 600100100 which makes it not feasible. Is it possible to reduce memory for top down dp approach specifically or only possible with bottom up?


  • 0
    Y

    Maybe divide the problem and do strs.size() top-down memorized DFSs?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.