Count Digits in a Number
Easy
Given a number n, return the count of digits in this number.
Example 1
Input
num = 1567
Output
4
Explanation
There are 4 digits in 1567, which are 1, 5, 6 and 7.
Example 2
Input
num = 99999
Output
5
Explanation
Number of digit in 99999 is 5.
Constraints
1 ≤ n ≤ 109
Hints:
Hint 1
Start with the straightforward approach, then optimize time or space if needed.
Auto
Loading editor...
Input
Expected Output