[Python] Explained, 2 lines, 1 pass, O(1) memory
Please feel free to ask questions or give suggestions. Upvote if you liked the solution.\n\n\ndef stoneGameIX(self, stones: List[int]) -> bool:\n\t"""\n\tStones
Please feel free to ask questions or give suggestions. Upvote if you liked the solution.\n\n```\ndef stoneGameIX(self, stones: List[int]) -> bool:\n\t"""\n\tStones can be of 3 types: ones with mod 0, ones with mod 1 and ones with mod 2\n\t\n\tCase 1: even number of 0s, they do nothing to change winner (can always be countered, so ignore)\n\tThen, Alice wins as long as both type 1 and type 2 stones are there (1 in mod and 2 in mod)\n\tLet a and b be the stone types with smaller and bigger counts respectively\n\tThen best moves in the game (ignoring 0s) are:       \n\t\t\t\t\t   Alice -> [a, b, b, b...]\n\t\t\t\t\t   Bob   -> [a, a, a, a...] or [b]\n\n\tCase 2: odd number of 0s, 0s can flip winner at most once\n\tAlice starts with bigger pile and wins as long as the bigger pile is at least 3 larger than the smaller pile (abs(mod[1]-mod[2])>2)\n\t"""\n\n\tmod = Counter(x%3 for x in stones)\n\n\treturn abs(mod[1]-mod[2])>2 if mod[0]%2 else 1 in mod and 2 in mod\n\n```
[]