2660. Determine the Winner of a Bowling Game
You are given two 0-indexed integer arrays
player1andplayer2, that represent the number of pins that player 1 and player 2 hit in a bowling game, respectively.The bowling game consists of
nturns, and the number of pins in each turn is exactly10.Assume a player hit
xipins in theithturn. The value of theithturn for the player is:
2xiif the player hit10pins in any of the previous two turns.- Otherwise, It is
xi.The score of the player is the sum of the values of their
nturns.Return
1if the score of player 1 is more than the score of player 2,2if the score of player 2 is more than the score of player 1, and0in case of a draw.
1 | class Solution { |