Description There are n coins in a line, and value of i-th coin is values[i]. Two players take turns to take a coin from one of the ends of the line until there are no more coins left. The player with the larger amount of money wins. Could you please…