Ahmad's blog

By Ahmad, history, 8 years ago, In English

Hello, relatively new to dynamic programming but I feel it's necessary for me to begin learning it well.

As far as I know, DP depends on storing the solution to previously solved subproblems and reusing them. But in this problem, I do not clearly see how that principle helps to solve this problem. I can only think of a naïve brute force where I try each pair of numbers that sum to s and count them like that.

Could anyone give me a hint as to how to approach thinking about this problem as well as other dynamic programming problems. Thanks in advance for any help.

Edit: I also want to try and avoid the editorial since it usually gives the solution away for me. Just a hint would be appreciated.

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Ahmad (previous revision, new revision, compare).