Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Since the sum of <code>nums</code>is at most <code>20000</code>, the number of distinct elements of nums is <code>200</code>.
Let <code>dp[x]</code> be the number of submultisets of <code>nums</code> with sum <code>x</code>.
The answer to the problem is <code>dp[l] + dp[l+1] + … + dp[r]</code>.
Use coin change dp to transition between states.