Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
724 views
There are two players James and Bob and they are playing a game and Game will be start by James only and rule is that we have to shoot marks from ends only and not from mid .
We have to make James win.
Example 1
input arr = [11,20,2,10]
output = 30
so in this case James can choose 11 or 10 , but suppose we make james to choose 10 only will se later why .
Then bob has [11, 20 ,2] now bob can choose 11 or 2 his wish
if he choose 11 then james has [20,2] now james choose 20
to total of james becomes 30 and he wins
Exmple 2:
input arr = [20, 2 ,10 ,11]
output = 30
similar to above but order is changed
Example 3:
input arr = [15, 19 ,2, 10]
output = 29
basically we have to maximize the james output

 

Same as.-> https://leetcode.com/problems/stone-game-vii/
in Online Assessments by Expert (108,190 points) | 724 views

Please log in or register to answer this question.