serega1112

914

Dec 30th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. class Solution:
  2.     def hasGroupsSizeX(self, deck: List[int]) -> bool:
  3.        
  4.         values = list(Counter(deck).values())
  5.         gcd = values[0]
  6.         for i in range(1, len(values)):
  7.             a = gcd
  8.             b = values[i]
  9.             while a % b != 0:
  10.                 a, b = b, a % b
  11.             gcd = b
  12.            
  13.         return gcd > 1
Advertisement
Add Comment
Please, Sign In to add comment