# Explain the approach applied in the solution

In this problem, basically there are three players. one player is watching other two players play. So, it is natural that the third person, who is watching the game, cannot win.

We are given a sequence consisting of N integers stating that ith game is won by A*.

We just have to check that at no point should the spectator win.

The solution You mentioned create a boolean array of size 3. if player* = true, ith player is playing right now.

Initially first two players are playing. So play[0] = true and play[1] = true

Then, in loop, he check if the play[A*-1] == false. This line means that the winner as per sequence is playing or not.

if play[A*-1] == false, sequence is not valid.

otherwise he changed status of all playing players to false, and the third player, whose play* == false, set play* = true

Then, as the problem said, winner play the next round, he set play[a*-1] = true

And this continues till N. and print answer.

Thank you.

No Problem mate.