From af9da84e4a356a7556d1e7fa30477f30443344f4 Mon Sep 17 00:00:00 2001 From: dmswl6310 Date: Wed, 12 Aug 2026 20:43:23 +0900 Subject: [PATCH] 0812 --- .../914. X of a Kind in a Deck of Cards.js" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "leetcode3/\355\231\251\354\235\200\354\247\200/914. X of a Kind in a Deck of Cards.js" diff --git "a/leetcode3/\355\231\251\354\235\200\354\247\200/914. X of a Kind in a Deck of Cards.js" "b/leetcode3/\355\231\251\354\235\200\354\247\200/914. X of a Kind in a Deck of Cards.js" new file mode 100644 index 00000000..b8544acb --- /dev/null +++ "b/leetcode3/\355\231\251\354\235\200\354\247\200/914. X of a Kind in a Deck of Cards.js" @@ -0,0 +1,27 @@ +/** + * @param {number[]} deck + * @return {boolean} + */ +var hasGroupsSizeX = function(deck) { + if(deck.length===1) return false; + + const numCount = {}; + for (const num of deck) { + numCount[num] = (numCount[num] || 0) + 1; + } + + const counts = Object.values(numCount); + + let totalGcd=counts[0]; + + const gcd=(a,b)=>{ + return b===0? a:gcd(b,a%b); + } + + for(let i=1;i=2 +}; \ No newline at end of file