Product Sum
Basic Accuracy: 52.13% Submissions: 1203 Points: 1

Given two integers a and b. Write a program to find the number of digits in the product of these two integers.

Example 1:

Input: a = 12, b = 4
Output: 2 
Explanation: 12*4 = 48
Hence its a 2 digit number.

Example 2:

Input: a = -24, b = 33
Output: 3
Explanation: -24*33 = -792
Hence its a 3 digit number.

Your Task:  
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 are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Product Sum

Output Window