Bootcamps
Masterclasses
Menu
Courses
Account
Login / Sign Up

Rock Paper Scissors

Basic Acceptance 93.42% Points 10

You are given a series of rounds, each containing the player's move and the computer's move. Your task is to determine the winner of each round, maintain the running score, and report the overall winner after all rounds are completed.

The game follows these standard rules:

  • Rock beats Scissors.
  • Scissors beats Paper.
  • Paper beats Rock.
  • If both players choose the same move, the round is a draw.

After evaluating all rounds, compare the total wins of both sides to determine the overall winner. If both have the same number of wins, the overall result is a draw.

Examples
Example 1

Input: rounds = [(rock, scissors), (paper, scissors), (rock, rock)]

Output: Round 1: Player, Round 2: Computer, Round 3: Draw - Overall: Draw (1-1)

Explanation: In the first round, the player wins because rock beats scissors. In the second round, the computer wins because scissors beats paper. The third round is a draw because both choose rock. The final score is tied at 1-1.

Example 2

Input: rounds = [(rock, scissors)]

Output: Round 1: Player - Overall: Player (1-0)

Explanation: Rock beats scissors, so the player wins the only round. The final score is 1-0.

Example 3

Input: rounds = [(paper, scissors), (rock, paper)]

Output: Round 1: Computer, Round 2: Computer - Overall: Computer (0-2)

Explanation: The computer wins the first round because scissors beats paper and the second round because paper beats rock. The final score is 0-2.

Constraints
  • 1 <= number of rounds <= 103
  • Each move must be one of rock, paper, or scissors.
Topics
Data Structures Basics
Companies
Apple Coinbase
Added 28 Nov 2026 93.42% acceptance
Ln 1, Col 1Sign in to save your code
1
rock scissors
Round 1: Player - Overall: Player (1-0)