Question: Given N intervals, find the maximum number of points covered by K intervals.
Codeforces- Painting The Fence
I do understand the brute force solution to this, I am looking for explanation of DP solution
I believe, there are two ways to solve this problem through DP. One uses, dp[x][used] and the other uses dp[x][skipped], where the second is more time efficient.
I am having hard time understanding both. Looking for explanation on both and not just the second one.