[C] math | Time: O(n), Space: O(1)
C []\nbool stoneGameIX(\n\tconst int * const stoneVals,\n\tconst int stoneValsLen\n){\n\tint cnts[3] = {0, 0, 0};\n\tfor (int i = 0; i < stoneValsLen; i += 1){\
```C []\nbool stoneGameIX(\n\tconst int * const stoneVals,\n\tconst int stoneValsLen\n){\n\tint cnts[3] = {0, 0, 0};\n\tfor (int i = 0; i < stoneValsLen; i += 1){\n\t\tassert(stoneVals[i] >= 0);\n\t\tcnts[stoneVals[i] % 3] += 1;\n\t}\n\n\tif (0 == cnts[1] && 0 == cnts[2]){\n\t\treturn false;\n\t}\n\n\tconst bool shouldSwitch = (cnts[0] % 2 != 0);\n\tif (cnts[1] >= 1){\n\t\tif (\n\t\t\t(cnts[1] - 1 < cnts[2] && !shouldSwitch) ||\n\t\t\t(cnts[1] - 1 - cnts[2] >= 2 && shouldSwitch)\n\t\t){\n\t\t\treturn true;\n\t\t}\n\t}\n\tif (cnts[2] >= 1){\n\t\tif (\n\t\t\t(cnts[2] - 1 < cnts[1] && !shouldSwitch) ||\n\t\t\t(cnts[2] - 1 - cnts[1] >= 2 && shouldSwitch)\n\t\t){\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n```
['C']