Remove Colored Pieces if Both Neighbors are the Same Color
Intuition\nIf Alice has a higher possible turn count than Bob, Alice is the winner. A possible turn is counted if the same letter occurs consecutively 3 times o
# Intuition\nIf Alice has a higher possible turn count than Bob, Alice is the winner. A possible turn is counted if the same letter occurs consecutively 3 times or more.\n\n# Approach\nI have declared some variables to check if the same letter occurs consecutively three times or more. If the consecutive count is 3 or greater, the possible turn count increases.\n\n# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\npublic class Solution {\n    public bool WinnerOfGame(string colors) {\n        int n = colors.Length;\n        int aliceTurn = 0;\n        int bobTurn = 0;\n        int countA = 0;\n        int countB = 0;\n\n        for (int i = 0; i < n; i++) {\n            if (colors[i] == \'A\') {\n                countA++;\n                countB = 0;\n\n                if (countA >= 3) {\n                    aliceTurn++;\n                }\n            } else if (colors[i] == \'B\') {\n                countB++;\n                countA = 0;\n\n                if (countB >= 3) {\n                    bobTurn++;\n                }\n            }\n        }\n\n        return aliceTurn > bobTurn;\n    }\n}\n\n```
['C#']