dp[i][j] = max( a[i] − dp[i+1][j], a[j] − dp[i][j−1] ) is the best score difference the player to move can force on coins a[i..j]. Watch the interval table fill by increasing length.
junior.md and professional.md for the proof that the subtraction encodes optimal adversarial play.