We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b6f4b4 commit 7bf6cf7Copy full SHA for 7bf6cf7
2029-stone-game-ix.js
@@ -0,0 +1,10 @@
1
+/**
2
+ * @param {number[]} stones
3
+ * @return {boolean}
4
+ */
5
+const stoneGameIX = function(stones) {
6
+ const cnt = Array(3).fill(0), { abs } = Math
7
+ for (let a of stones) cnt[a % 3]++;
8
+ if (cnt[0] % 2 == 0) return cnt[1] && cnt[2]
9
+ return abs(cnt[1] - cnt[2]) >= 3
10
+};
0 commit comments