Can anyone help me for the solution of below problem? I am trying to solve it using simulation of rounds and counting. Is there a DP involved here?
In a Rock Paper Scissors tournament, players stand in a line and each consecutive pair competes in a round. If there is an odd number of players, the last one automatically advances. They each choose a hand formation, either Rock(R), Paper(P), or Scissors(S). Outcomes are based on these rules:
Winners proceed to the next round while losers are eliminated. If there is a tie, both players are out.
A player, the person of interest (POI), wants to win while changing their hand formation as few times as possible. All other players must continue with their first choice. Determine the minimum number of changes the POI must make to win the tournament.
Example 1
Input: n = 3 players, poi = 2 play of interest, formations = "PS"
Output: 0
Explanation: The player of interest is at position 2 (0-based index).
Since the POI never needs to change the hand formation, the answer is 0.
Example 2
Input: n = 4 players, poi = 1 player of interest, formations = "PRS"
Output: 1
Explanation: Players 0, 2 and 3 choose 'P', 'R' and 'S' respectively.