From 14d7cf01626aeff3630799a4ae5de177868fd1fb Mon Sep 17 00:00:00 2001 From: rimogsu Date: Wed, 12 Aug 2026 21:35:42 +0900 Subject: [PATCH] 914 --- .../914. X of a Kind in a Deck of Cards.py" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "leetcode3/\353\263\200\354\247\200\355\230\221/v2/914. X of a Kind in a Deck of Cards.py" diff --git "a/leetcode3/\353\263\200\354\247\200\355\230\221/v2/914. X of a Kind in a Deck of Cards.py" "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/914. X of a Kind in a Deck of Cards.py" new file mode 100644 index 00000000..d2eea5d3 --- /dev/null +++ "b/leetcode3/\353\263\200\354\247\200\355\230\221/v2/914. X of a Kind in a Deck of Cards.py" @@ -0,0 +1,23 @@ +from collections import defaultdict +from math import gcd + +class Solution: + def hasGroupsSizeX(self, deck: List[int]) -> bool: + if len(deck) == 1: + return False + + dic = defaultdict(int) + for d in deck: + dic[d] += 1 + + n = len(deck) + + print(dic) + + ans = False + for i in range(2,n//2+2): + if all([j % i == 0 for j in dic.values()]): + ans = True + break + + return ans \ No newline at end of file