#2660

Determine the Winner of a Bowling Game

pupil · 530 · lc easy +28 · 37.2% accepted · 293 likes · top 15%

Description

Two players bowl n turns each, represented by arrays player1 and player2. On turn i, a player's pins count double if they knocked down 10 pins on turn i-1 or i-2; otherwise it counts normally. Sum each player's total. Return 1 if player 1 wins, 2 if player 2 wins, or 0 for a draw.

Code

1
2
3