Given two integer numbers a and b, the task is to find count of all common divisors of given numbers.
Input: a = 12, b = 24
Explanation: all common divisors
are 1, 2, 3, 4, 6 and 12.
Input: a = 3, b = 17
Explanation: all common divisors are 1.
You dont need to read input or print anything. Complete the function commDiv() which takes n as input parameter and returns the number of common divisors.
Expected Time Complexity: O(sqrt(n))
Expected Auxiliary Space: O(1)
1<= a,b <=1000
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.