you initial power power initial score 0 bag tokens tokensi value ith token 0indexedyour goal maximize total score potentially play token waysif current power tokensi play ith token face lose tokensi power gain 1 scoreif current score 1 play ith token face gain tokensi power lose 1 scoreEach token play order you play tokensreturn large possible score achieve playing number token Example 1Input token 100 power 50output 0explanation play token bag impossible little power little scoreExample 2input tokens 100200 power 150output 1explanation play 0th token 100 face power 50 score 1there need play 1st token play face add scoreexample 3input tokens 100200300400 power 200output 2explanation play token order score 21 play 0th token 100 face power 100 score 12 play 3rd token 400 face power 500 score 03 play 1st token 200 face power 300 score 14 play 2nd token 300 face power 0 score 2 constraints0 tokenslength 10000 tokensi power 104