Search
⌘K

Leetcode 2427. Number of Common Factors

Count how many positive integers divide both a and b — compute g = gcd(a, b) and return the number of divisors of g. With 1 ≤ a, b ≤ 1000 this is efficiently done by checking divisors up to sqrt(g).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.