Simple Greedy
Start with any element with mod3  equal to 1 or 2 and greedily take elements that do not form sum divisible by 3.\nThe crux is that we can take elements in any 
Start with any element with mod3  equal to 1 or 2 and greedily take elements that do not form sum divisible by 3.\nThe crux is that we can take elements in any order as long as they don\'t from equal number of 1\'s and 2\'s in the prefix.\n\n```\nclass Solution\n{\n  public:\n    bool get(vector<int> mod, int n, int k)\n    {\n        if (mod[k] < 1)\n            return false;\n        mod[k]--;\n        int sum = k;\n        for (int i = 1; i < n; i++)\n        {\n            if (mod[1] && (sum + 1) % 3 != 0)\n                mod[1]--, sum += 1;\n            else if (mod[2] && (sum + 2) % 3 != 0)\n                mod[2]--, sum += 2;\n            else if (mod[0] > 0 && (sum) % 3 != 0)\n                mod[0]--;\n            else\n                return i & 1;\n        }\n        return false;\n    }\n\n    bool stoneGameIX(vector<int> &v)\n    {\n        vector<int> mod(3);\n        int n = v.size();\n        for (int i = 0; i < n; i++)\n        {\n            mod[v[i] % 3]++;\n        }\n        return get(mod, n, 2) || get(mod, n, 1);\n    }\n};\n```
[]