• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Algorithms | Misc | Question 14

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

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments