please provide some hint
Unable to solve
At each instance we would need to consider two possibilities that we can pick the first as well as the last element of the remaining array. Both these possibilities give rise to two more possibilities depending on the other player. Since the second player plays optimally and try to minimise our score. So overall we have two possibilities at each instance.
For the first possibility , where we could pick the first element , the other player will pick the next element from the side that would minimise our total score.
Similarly , for the second possibility , where we can pick the last element , the other player would still pick the next element from the side that would minimise our total score.
We entertain both these cases and take the maximum result of the two and return that result.
We take two pointer variables , say ‘i’ and ‘j’ which each represent the starting and the ending point of the remaining array currently in consideration. We work till the two pointers cross each other
refer to below code : - https://ide.codingblocks.com/s/282455

cannot understand why we are passing these specific indices in optiomal game function in both the lines
This is because these are states possible when you start from (i,j) and pick from first or pick from last.
We remove an extra coin after removing the current because the other player would also make a move.
why i+2 and j-2 in both the statements?
If you pick a coin from the front , then you are at (i+1,j), now the second person makes a move so that you get the minimum after that. Now he can got to two states (i+1,j-1), i.e., he picks from last or (i+2,j)
He picks from start. So whichever returns minimum he picks that.
pick last is if you pick from last.
(i+1,j-1) doesn’t matter even if it’s used twice.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.