Is there 2D-array dp solution just like the complete backpack problem?


  • 1
    C

    In complete backpack problem, the 1D-array dp solution is a optimization of 2D-array dp solution.In the discuss , most solution is 1D-array dp solution, how to write the 2D-array dp solution just like the complete backpack problem?


  • 0
    L

    I think there is. But is not simple as 1D-array. Because we need to scan the 2D-array, column by column and each time scan the first row element of j column, we need to use the last row element of column j - 1. It makes it not easy.
    Even if this problem seems like 0/1 backpack problem, but we'd better think is as what the top solution shows


Log in to reply
 

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