1# Runtime: 130 ms (Top 52.6%) | Memory: 16.56 MB (Top 64.6%)234class Solution:5def hasGroupsSizeX(self, deck: List[int]) -> bool:67f = defaultdict(int)89for j in deck:10f[j] += 11112import math1314u = list(f.values())1516g = u[0]1718for j in range(1, len(u)):19g = math.gcd(g, u[j])20return g != 1