Golang O(n) solution with explanation
go\nfunc stoneGameIX(stones []int) bool {\n\tres0, res1, res2 := 0, 0, 0\n\tfor _, s := range stones {\n\t\tswitch s % 3 {\n\t\tcase 0:\n\t\t\tres0++\n\t\tcase 
```go\nfunc stoneGameIX(stones []int) bool {\n\tres0, res1, res2 := 0, 0, 0\n\tfor _, s := range stones {\n\t\tswitch s % 3 {\n\t\tcase 0:\n\t\t\tres0++\n\t\tcase 1:\n\t\t\tres1++\n\t\tcase 2:\n\t\t\tres2++\n\t\t}\n\t}\n\t// we suppose res1 <= res2\n\tif res2 < res1 {\n\t\tres1, res2 = res2, res1\n\t}\n\t// only res0 exists, Alice picks one and lose the game\n\tif res1 == 0 && res2 == 0 {\n\t\treturn false\n\t}\n\tif res1 == 0 {\n\t\tif res2 <= 2 {\n\t\t\t// nothing left after pick all elements, Bob will win\n\t\t\treturn false\n\t\t}\n\t\t// the player who acts first loses the game\n\t\t// res0 change the order if odd\n\t\treturn res0%2 == 1\n\t}\n\t// res0 is even, Alice picks 1 and win\n\tif res0%2 == 0 {\n\t\treturn true\n\t}\n\t// res0 is odd, Alice picks 2, Bob has to pick 1, if 1 used up first, Alice wins\n    // 2->3->2->1->2->(no 1, but 2 exits now)\n\treturn res2 > res1+2\n}\n```
['Go']