gcd
to -1 to store the greatest common divisor of the counts.gcd
with the GCD of gcd
and the current count using a GCD helper function.gcd
becomes 1, return false
as we cannot partition the deck.gcd
is greater than 1, return true
. Otherwise, return false
.