题目描述
Given an integer N. The task is to count the number of integers from 1 to N(inclusive) which contain 0’s as a digit.
Example 1:
Input: N = 21
Output: 2
Explanation: All numbers are 10,20.
ââ¬â¹Example 2:
Input: N = 101
Output: 11
Explanation: All numbers are 10,20
30,40,50,60,70,80,90,100,101.
Your Task:
You don't need to read input or print anything. Your task is to complete the function countZero() which takes N as inputs and returns the answer.
Expected Time Complexity: O(log N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N≤ 10^{6}
输入格式
见题面
输出格式
见题面
样例输入
N = 21
样例输出
2