# Optimal Strategy For A Game

#### Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

`1. You are given an array(arr) of length N, where N is an even number.2. The elements of the array represent N coins of values arr1,arr1...arrN.3. You are playing a game against an opponent in an alternative way, where the opponent is equally smart.4. In this game, a player selects either the first or the last coin from the row in every turn, removes it from the row permanently, and receives the value of the coin.5. You have to find the maximum possible amount of money you can win if you make the first move.`
Input Format
`A number Narr1arr2...N numbers`
Output Format
`Check the sample output and question video.`
Question Video
Constraints
`2 <= N <= 10001 <= arr[i] <= 10^6`
Sample Input
`453710`
Sample Output
`15`

• Related Topics

Run

Run
Id Name