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 7bad751 commit 17e381eCopy full SHA for 17e381e
914.卡牌分组.js
@@ -0,0 +1,27 @@
1
+/**
2
+ * @param {number[]} deck
3
+ * @return {boolean}
4
+ */
5
+var hasGroupsSizeX = function(deck) {
6
+ const map = {};
7
+ let max = 0;
8
+ for (let i = 0; i < deck.length; i++) {
9
+ map[deck[i]] = map[deck[i]] || 0;
10
+ map[deck[i]]++;
11
+ max = Math.max(max, map[deck[i]]);
12
+ }
13
+
14
+ const countList = Object.values(map);
15
+ for (let i = 2; i <= max; i++) {
16
+ let j = 0;
17
+ for (; j < countList.length; j++) {
18
+ if (countList[j] % i !== 0) {
19
+ break;
20
21
22
+ if (j === countList.length) {
23
+ return true;
24
25
26
+ return false;
27
+};
0 commit comments