1
var hasGroupsSizeX = function (deck) {
2
let unique = [...new Set(deck)],
3
three = 0,
4
two = 0,
5
five = 0,
6
size = 0,
7
same = 0,
8
s = 0;
9

10
for (let i = 0; i < unique.length; i++) {
11
for (let y = 0; y < deck.length; y++) {
12
if (unique[i] === deck[y]) {
13
size++;
14
}
15
}
16
if (size < 2) return false;
17
if (size % 2 === 0) two++;
18
if (size % 3 === 0) three++;
19
if (size % 5 === 0) five++;
20
if (s === size) same++;
21
s = size;
22
size = 0;
23
}
24

25
if (
26
Math.max(two, three, five) !== unique.length &&
27
same !== unique.length - 1
28
)
29
return false;
30
return true;
31
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0