Skip to content

Commit b94deba

Browse files
Merge pull request #1820 from CodingTestStudy2/변지협
[변지협] Day14
2 parents f673aa5 + 14d7cf0 commit b94deba

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from collections import defaultdict
2+
from math import gcd
3+
4+
class Solution:
5+
def hasGroupsSizeX(self, deck: List[int]) -> bool:
6+
if len(deck) == 1:
7+
return False
8+
9+
dic = defaultdict(int)
10+
for d in deck:
11+
dic[d] += 1
12+
13+
n = len(deck)
14+
15+
print(dic)
16+
17+
ans = False
18+
for i in range(2,n//2+2):
19+
if all([j % i == 0 for j in dic.values()]):
20+
ans = True
21+
break
22+
23+
return ans

0 commit comments

Comments
 (0)