Practice Determine the Winner of a Bowling Game
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Each player's array gives pins hit per turn. A turn scores twice its pins if that player hit 10 pins in either of the preceding two turns; otherwise it scores its pins normally. Sum each player's turn scores. Return 1 if player1 has the higher score, 2 if player2 does, or 0 for a tie.
Source: Determine the Winner of a Bowling Game on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
player1 = [5,10,3,2], player2 = [6,5,7,3]
Output
1
# Example 2
Input
player1 = [3,5,7,6], player2 = [8,10,10,2]
Output
2
# Example 3
Input
player1 = [2,3], player2 = [4,1]
Output
0
# Example 4
Input
player1 = [1,1,1,10,10,10,10], player2 = [10,10,10,10,1,1,1]
Output
2
Constraints
n == player1.length == player2.length
1 <= n <= 1000
0 <= player1[i], player2[i] <= 10
Related LeetCode Problems
Practice more problems similar to Determine the Winner of a Bowling Game.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.