From 8bc820e87a295bc9597886c5f8bc0649eacae465 Mon Sep 17 00:00:00 2001 From: choiminji Date: Wed, 12 Aug 2026 20:58:15 +0900 Subject: [PATCH] Day14 --- .../914.py" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "leetcode3/\354\265\234\353\257\274\354\247\200/914.py" diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/914.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/914.py" new file mode 100644 index 00000000..9a1efd9a --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/914.py" @@ -0,0 +1,24 @@ +class Solution: + def hasGroupsSizeX(self, deck: List[int]) -> bool: + deck.sort() + count = {} + first = deck[0] + for d in deck: + if d in count: + count[d] += 1 + else: + count[d] = 1 + + values = list(count.values()) + values.sort() + + check = len(values) + + for i in range(2, values[-1] + 1): + check = 0 + for v in values: + if v % i == 0: + check += 1 + if check == len(values): + return True + return False \ No newline at end of file