Otimal game..............challenge


getting correct output for given input but getting segmentation fault for big set of output,why is it so

it is not necessary that player will always pick largest value coin
let’s consider this case
4 11 3 2 1
here first player will definitely choose 1 not 4
because if first player choose 4 then second takes 11 which is not profitable for first player

i hope you understand your mistake

Reference Code

https://ide.codingblocks.com/s/418949 like this?

no replies yet ?..

sorry i didn’t see

NO this will not work
as both plays optimally
means both players are smart both try to pick best possible coin

i have already shared the correct approach