HELP!! DP knapsack space optimization 3d to 2d how??

Правка en1, от sridhar153999, 2020-02-29 15:20:28

HELLO CODERS

i found this dp problem on leetcode (ones and zeros) (https://leetcode.com/problems/ones-and-zeroes/) i solved it using 3 states [position][no_of_zeros][no_of_ones] its giving me memory limit exceeded i saw some people using 2d state [no_of_zeros][no_of_ones] .i cant understand how they come up with their solution .help me explaining their 2 d concept. MY solution link solution although the time complexity of my code and thier code is same.

Теги 0/1 knapsack, #2d-dp, #3d-dp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский sridhar153999 2020-02-29 15:20:28 593 Initial revision (published)