Thx a lot !!!
I'm also got quite confused about this before I tracked your answer.
- increasing i then the previous partial result
dp[i - coin]is the result that has considered
- decreasing i then the previous partial result
dp[i - coin]is the result that has not considered
But I still don't understand the reason why increasing i means considered
coin already while decreasing doesn't.
Can I simply assume that
increasing i means I could use element in the given array many times while
decreasing i means I could only use element once?
Since I'm new to dp, could you offer me an intuitive explanation?
Your code is my favorite style and personal preference. Thumbs up!
Hey buddy, this post really helps! I've been stuck in the difference for hours. :P
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.