There was an error while loading. Please reload this page.
1 parent d9bfb53 commit 8bc820eCopy full SHA for 8bc820e
1 file changed
leetcode3/최민지/914.py
@@ -0,0 +1,24 @@
1
+class Solution:
2
+ def hasGroupsSizeX(self, deck: List[int]) -> bool:
3
+ deck.sort()
4
+ count = {}
5
+ first = deck[0]
6
+ for d in deck:
7
+ if d in count:
8
+ count[d] += 1
9
+ else:
10
+ count[d] = 1
11
+
12
+ values = list(count.values())
13
+ values.sort()
14
15
+ check = len(values)
16
17
+ for i in range(2, values[-1] + 1):
18
+ check = 0
19
+ for v in values:
20
+ if v % i == 0:
21
+ check += 1
22
+ if check == len(values):
23
+ return True
24
+ return False
0 commit comments