Please enter your email address or userHandle.
Given two integers a and b. Write a program to find the number of digits in the product of these two integers.
Input: a = 12, b = 4
Explanation: 12*4 = 48
Hence its a 2 digit number.
Input: a = -24, b = 33
Explanation: -24*33 = -792
Hence its a 3 digit number.
You dont need to read input or print anything. Complete the function countDigits() which takes a and b as input parameter and returns the number of digits in the product of the two numbers.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
-108<= a,b <=108
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.