vatsalseth33's blog

By vatsalseth33, history, 4 years ago, In English

Problem — Link
Editorial — Link
Should'nt the solution be dp[i] = sum(dp[j]*dp[i-j]) for j=3 to i-3 where i is the required sum for the iteration ? My reasoning is that when ever we use a sequence of sum j (whose count is dp[j]) then we can append another sequence of sum i-j to it to make total sum i. The editorial says to find dp[i] we just find sum(dp[j]) for j=i-3 to 0. Can someone explain how?

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