Define the states Let = maximum points out of values from to . You want to compute , where If you define your dp like this, the base case is simple.
Now think of the transition (how to compute dp[i] from earlier values). Work through examples by hand before coding. Understanding the pattern makes implementation simple. Practice with similar problems to reinforce your understanding.