1. Define the states Let dp[i] = maximum points out of values from 1 to i. You want to compute dp[M], where M=max(a1,a2,…,an). 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.