Elegant solution to BOXGAM97

let’s say its jafars turn and array is 4, 1, 9, 5

Then, if moving is mandatory and k is even then in first turn jafar can place it on 5 and almir will need to move it to 9.

If moving is not necessary then if jafar keeps on 5 almir won’t shift it to 9.
And if kept on 9 he’ll move it to 5

You can see answer changes completely. I personally think they should have mentioned “should” move instead of “can”

1 Like

I had a similar logic, it was mentioned in question player “can” move to left or right, so kept including ai with ai-1 & ai+1