Java O(N)
\nclass Solution {\n    public boolean stoneGameIX(int[] stones) {\n        int zero = 0, one = 0, two = 0;\n        for(int i: stones) {\n            if(i %3 =
```\nclass Solution {\n    public boolean stoneGameIX(int[] stones) {\n        int zero = 0, one = 0, two = 0;\n        for(int i: stones) {\n            if(i %3 == 0) zero++;\n            else if(i%3 == 1) one ++;\n            else if(i%3 == 2) two ++;\n        }\n        if(one == 0 && two == 0) return false;\n        int max = Math.max(one, two), min = Math.min(one, two);\n        if(zero%2 == 0){\n            if(min == 0) return false;\n            return true;\n        }\n        if(zero%2 == 1){\n            if(max -2 > min) return true;\n            return false;\n        }\n        return false;\n        \n            \n    }\n}\n```
[]