deepak_097's blog

By deepak_097, history, 6 years ago, In English

Please help me to solve this problem — link

Please mention this kind of problems in comment section.

Contest link — link

Thank you :)

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it +3 Vote: I do not like it
  • »
    »
    6 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Can you please explain the logic how to store dp[x][y].I am unable to understand the logic mentioned in the above link comment section.

    • »
      »
      »
      6 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      You can apply the knapsack type DP approach to fill the table. The main logic For finding DP[x][i] you can take j = 1 to i values from current DP and take remaining (i-j) values from it's child DP and update current DP.