Easy Python solution with Explanation | O(n) O(1) Beats 99.93%
\n# Approach\n Describe your approach to solving the problem. \nSince we need to have 3 A\'s or 3 B\'s in a sequence, We will first calculate the number of thos
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nSince we need to have 3 A\'s or 3 B\'s in a sequence, We will first calculate the number of those occurences.\nBut if the given string length is less than 3, there is no possibility of starting the game. So we return False\nWe now compare the number of occurances of the A\'s and B\'s \nand return True if Alice is winning (when the A\'s count is greater than B\'s count)\nand return Flase otherwise\n\n## Note\n When I say Occurances of A\'s and B\'s, I mean the AAA or BBB.\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def winnerOfGame(self, colors: str) -> bool:\n        if len(colors)<3:\n            return False\n        a_count=0\n        b_count=0\n        for i in range(len(colors)-2):\n            if colors[i]==colors[i+1]==colors[i+2]=="A":\n                a_count+=1\n            elif colors[i]==colors[i+1]==colors[i+2]=="B":\n                b_count+=1\n        if a_count>b_count:\n            return True\n        elif a_count>b_count:\n            return False\n```
['Python3']