Given a number d, representing the number of digits of a number. Find the total count of positive integers which have at-least one zero in them and consist d or less digits.
Example 1:
Input: d = 2
Output: 9 
Explanation: There are total 9 
positive integers which have 
at-least one zero in them 
and consist 2 or less digits.
Example 2:
Input: d = 3
Output: 180
Explanation: There are total 180
positive integers which have
at-least one zero in them
and consist 3 or less digits.
Your Task:  
You dont need to read input or print anything. Complete the function findCountUpto() which takes d as input parameter and returns the total count of positive integers which have at-least one zero in them and consist d or less digits.
Expected Time Complexity: O(logn)
Expected Auxiliary Space: O(1)
Constraints:
1<= d <=15

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3
class Solution:
    def findCountUpto (ob, d):
        # code here 

Solutions:
class Solution:

	def findCountUpto(ob, n):
		return 9 * (10 ** n - 1) // 9 - 9 * (9 ** n - 1) // 8


class Solution:

	def findCountUpto(ob, d):
		n = d
		ans = 9 * (10 ** n - 1) // 9 - 9 * (9 ** n - 1) // 8
		return ans


class Solution:

	def findCountUpto(ob, n):

		def helper(x):
			if x == 2:
				return 9
			else:
				a = 9
				b = 9
				for i in range(x - 1):
					a *= 10
					b *= 9
				c = a - b
				d = helper(x - 1)
				return d + c
		return helper(d)


class Solution:

	def findCountUpto(ob, d):
		su = 10 ** d - 1
		while d:
			su = su - 9 ** d
			d -= 1
		return su


class Solution:

	def findCountUpto(ob, d):
		return 9 * (10 ** d - 1) // 9 - 9 * (9 ** d - 1) // 8


class Solution:

	def findCountUpto(self, d):
		if d == 1:
			return 0
		else:
			ans = 9 * 10 ** (d - 1) - 9 ** d + self.findCountUpto(d - 1)
		return ans


class Solution:

	def findCountUpto(ob, d):
		s = 0
		g = '9' * d
		g = int(g)
		p = 1
		for i in range(d):
			p = p * 9
			s += p
		return g - s


class Solution:

	def findCountUpto(ob, d):
		n = d
		ans = 9 * (10 ** n - 1) // 9 - 9 * (9 ** n - 1) // 8
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		d = int(input())
		ob = Solution()
		print(ob.findCountUpto(d))


class Solution:

	def findCountUpto(ob, n):
		c = 0
		if n == 1:
			return c
		else:
			c += 9
			d = c
			for i in range(3, n + 1):
				d = (10 ** (i - 2) + d) * 9
				c = c + d
		return c
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		d = int(input())
		ob = Solution()
		print(ob.findCountUpto(d))


class Solution:

	def findCountUpto(ob, d):
		summ = pow(10, d) - 1
		while d:
			summ -= pow(9, d)
			d -= 1
		return summ
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		d = int(input())
		ob = Solution()
		print(ob.findCountUpto(d))


class Solution:

	def findCountUpto(ob, d):
		if d == 1:
			return 0
		if d == 2:
			return 9
		n1 = 9 * 10 ** (d - 1)
		n2 = 9 ** d
		x1 = n1 - n2
		x2 = ob.findCountUpto(d - 1)
		return x1 + x2


class Solution:

	def findCountUpto(ob, d):
		if d == 0 or d == 1:
			return 0
		c = 0
		for i in range(2, d + 1):
			c = c + (9 * pow(10, i - 1) - 9 * pow(9, i - 1))
		return c


class Solution:

	def findCountUpto(ob, d):
		if d < 1:
			return 0
		c = 9 * (10 ** (d - 1) - 9 ** (d - 1))
		return c + ob.findCountUpto(d - 1)


import math

class Solution:

	def findCountUpto(ob, d):
		return 9 * (10 ** d - 1) // 9 - 9 * (9 ** d - 1) // 8


import math

class Solution:

	def findCountUpto(ob, d):
		count = 0
		for i in range(d + 1):
			count += 9 * int(math.pow(10, i - 1) - int(math.pow(9, i - 1)))
		return count


class Solution:

	def findCountUpto(ob, d):
		if d < 1:
			return 0
		count = 9 * (pow(10, d - 1) - pow(9, d - 1))
		return count + ob.findCountUpto(d - 1)


class Solution:

	def findCountUpto(ob, d):
		num1 = 0
		num2 = 0
		count = 0
		while d >= 2:
			num1 = 9 * 10 ** (d - 1)
			num2 = 9 ** d
			count += num1 - num2
			d -= 1
		return count