Simple intutive solution.
Approach:\n     1. Alice starts with 1 or 2 and on each turn look for option that avoids the sum to be multiple of 3.\n     2. Ex: If sum is 1 look for 1 or 0 a
Approach:\n     1. Alice starts with 1 or 2 and on each turn look for option that avoids the sum to be multiple of 3.\n     2. Ex: If sum is 1 look for 1 or 0 and if sum is 2 look for 2 or 0.\n     3. Lastly if number of turns played is divisble by 2 or is equal to len of stones Bob or else Alice wins .\n\n```\nclass Solution:\n    def stoneGameIX(self, stones: List[int]) -> bool:\n        def solve(x):\n            d = defaultdict(lambda:0)\n            for y in stones:\n                d[y%3]+=1\n            sums = 0\n            if d[x]==0:\n                return False \n            d[x]-=1\n            sums+=x\n            res = 1\n            while(sums%3!=0):\n                if sums%3==1:\n                    if d[1]>0:\n                        d[1]-=1\n                        sums = 2\n                    elif d[1]==0 and d[0]>0:\n                        d[0]-=1\n                        sums = 1 \n                    else:\n                        break\n                else:\n                    if d[2]>0:\n                        d[2]-=1\n                        sums = 1\n                    elif d[2]==0 and d[0]>0:\n                        d[0]-=1\n                        sums = 2\n                    else:\n                        break \n                res+=1\n            if res!=len(stones) and res%2==1:\n                return True \n            return False \n        if solve(1) or solve(2):\n            return True \n        return False \n```
[]