diff --git a/leetcode3/749. Contain Virus.py "b/leetcode3/\354\265\234\354\233\220\354\244\200/749. Contain Virus.py" similarity index 100% rename from leetcode3/749. Contain Virus.py rename to "leetcode3/\354\265\234\354\233\220\354\244\200/749. Contain Virus.py" diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/914. X of a Kind in a Deck of Cards.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/914. X of a Kind in a Deck of Cards.py" new file mode 100644 index 00000000..966d8678 --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/914. X of a Kind in a Deck of Cards.py" @@ -0,0 +1,15 @@ +from collections import defaultdict +class Solution: + def hasGroupsSizeX(self, deck: List[int]) -> bool: + counter = defaultdict(int) + for d in deck: + counter[d] += 1 + + count = counter[deck[0]] + for _, freq in counter.items(): + if freq == 1: + return False + count = gcd(count, freq) + + return True if count != 1 else False +