From 4a83f95b8a0c6da8f3d2a594e0bfee558f07ffc3 Mon Sep 17 00:00:00 2001 From: unknown <1326cy@gmail.com> Date: Wed, 12 Aug 2026 23:52:59 +0900 Subject: [PATCH] day14 --- .../914. X of a Kind in a Deck of Cards.py" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "leetcode3/\353\202\250\355\232\250\354\240\225/914. X of a Kind in a Deck of Cards.py" diff --git "a/leetcode3/\353\202\250\355\232\250\354\240\225/914. X of a Kind in a Deck of Cards.py" "b/leetcode3/\353\202\250\355\232\250\354\240\225/914. X of a Kind in a Deck of Cards.py" new file mode 100644 index 00000000..690f6ccf --- /dev/null +++ "b/leetcode3/\353\202\250\355\232\250\354\240\225/914. X of a Kind in a Deck of Cards.py" @@ -0,0 +1,18 @@ +from collections import Counter +import math + +class Solution: + def hasGroupsSizeX(self, deck: List[int]) -> bool: + # 모든 숫자의 등장 횟수 찾기 + counts = Counter(deck).values() + g = 0 + + # 등장 횟수 간의 최대 공약수 찾기 + for count in counts: + g = math.gcd(g, count) + + # 최대 공약수가 1이면 배열 구할 수 없음 + if g > 1: + return True + return False +