You are given a random set of numbers (unsorted).
There are two players. They will take turns alternatevely to pick a number either from the start or end.
Total score of a player is the sum of the numbers picked by a player.
If you are one of the players , find the maximum score you can achieve.
e.g. 1 , 2 , 3, 4 , 5
Iterationo 1 :
Player 1 picks : 5
Player 2 picks : 1
Iteration 2 :
Player 1 picks : 4
Player 2 picks : 2
Iteration 3:
Player 1 picks : 3
Player 2 picks : NA (As array is empty now)
Score of player 1 : 12 and player 2 : 3