Ctrl K

Strike Bonus Duel

Easy
Alice and Bob each bowled n turns. Every turn starts with 10 pins standing; alice[i] and bob[i] are how many pins each of them knocked down on turn i. A turn is scored like this: if the player knocked down all 10 pins on either of the two previous turns, the pins of this turn count double; otherwise they count as is. A player's total is the sum over all turns. Return 1 if Alice has more points, 2 if Bob does, and 0 for a draw.
Example 1
alice=[10, 4, 4, 9], bob=[7, 8, 9, 6] → 1

Alice strikes on the first turn, so the next two are doubled: 10 + 8 + 8 + 9 = 35. Bob has 7 + 8 + 9 + 6 = 30. Alice wins.

Example 2
alice=[3, 3, 3], bob=[0, 10, 1] → 2

Alice scores 9. Bob scores 0 + 10 + 2 = 12. Bob wins.

Example 3
alice=[10, 10, 0], bob=[10, 0, 10] → 0

Alice: 10 + 20 + 0 = 30. Bob: 10 + 0 + 20 = 30. A draw.

Constraints
  • 1 ≤ n ≤ 1000
  • len(alice) == len(bob) == n
  • 0 ≤ alice[i], bob[i] ≤ 10
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsHow Long the Light Stayed On EasyRepack the Tray EasyQuiz Score Log EasyMirror and Negate a Bitmap EasySwap Rows and Columns Easy
loading Python…
Input
alice=[10, 4, 4, 9], bob=[7, 8, 9, 6]
Expected
1

Run checks the first 3 tests in your browser. Submit checks all 95 tests on the server, hidden ones included.