Tap here to switch tabs
Problem
Ask
Submissions

Problem: Flip Game

med
30 min
Explore the Flip Game problem where players flip pairs of consecutive plus signs to minus signs. Understand how to apply backtracking techniques to generate all possible game states after a single move. This lesson helps you grasp problem assessment and solution formulation for coding interviews involving state transitions and game logic.

Statement

You are playing a Flip Game with a friend.

You are given a string currentState consisting only of the characters '+' and '-'. Players take turns flipping two consecutive "++" into "--". The game ends when a player cannot make a move, at which point the other player wins.

Return all possible states of currentState after performing exactly one valid move. The answer may be returned in any order. If no valid move exists, return an empty list.

Constraints:

  • 11 \leq currentState.length 500\leq 500

  • currentState[i] is either '+' or '-'

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Flip Game

med
30 min
Explore the Flip Game problem where players flip pairs of consecutive plus signs to minus signs. Understand how to apply backtracking techniques to generate all possible game states after a single move. This lesson helps you grasp problem assessment and solution formulation for coding interviews involving state transitions and game logic.

Statement

You are playing a Flip Game with a friend.

You are given a string currentState consisting only of the characters '+' and '-'. Players take turns flipping two consecutive "++" into "--". The game ends when a player cannot make a move, at which point the other player wins.

Return all possible states of currentState after performing exactly one valid move. The answer may be returned in any order. If no valid move exists, return an empty list.

Constraints:

  • 11 \leq currentState.length 500\leq 500

  • currentState[i] is either '+' or '-'