Skip to content
Related Articles

Related Articles

Improve Article

Algorithms | Misc | Question 14

  • Last Updated : 28 Jun, 2021

You are given an array with even integer elements. You and some other player take turns to pick numbers. Each player can pick either the leftmost element or the rightmost number. Find the maximum possible score (sum of numbers chosen) by you.
For example: if array is 5 8 4 2, then player you can choose either 5 or 2. Suppose you choose 2, then the other player can choose 5 or 4. Irrespective of what player 2 chooses, in next round you will have chance to choose 8. Thus, maximum possible score by player you, in this scenario, is (8+2)=10.
This problem can efficiently solved using?
(A) Greedy Algorithm
(B) Dynamic Programming
(C) Backtracking
(D) Recursion.


Answer: (B)

Explanation: See Optimal Strategy for a Game


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :