Alice Bob turn play game Alice start firstThere n stone arrange row on player turn remove leftmost stone rightmost stone row receive point equal sum remain stone value row the winner high score stone leave removeBob find lose game poor Bob lose decide minimize score difference Alices goal maximize difference scoregiven array integer stone stonesi represent value ith stone leave return difference Alice Bobs score play optimally example 1input stone 53142output 6explanation Alice remove 2 get 5 3 1 4 13 point Alice 13 Bob 0 stone 5314 Bob remove 5 get 3 1 4 8 point Alice 13 Bob 8 stone 314 Alice remove 3 get 1 4 5 point Alice 18 Bob 8 stone 14 Bob remove 1 get 4 point Alice 18 Bob 12 stone 4 Alice remove 4 get 0 point Alice 18 Bob 12 stone the score difference 18 12 6example 2input stone 7905110010102output 122 Constraintsn stoneslength2 n 10001 stonesi 1000