# Count N-digit numbers that contains every possible digit atleast once

Count N-digit numbers that contains every possible digit atleast onceGiven a positive integer N, the task is to count the number of N-digit numbers such that every digit from [0-9] occurs at least once.   Examples : Input: N = 10Output : 3265920Input: N = 5Output: 0Explanation: Since the number of digits is less than the minimum number of digits required [0-9], the answer is 0.Naive Approach: The simplest approach to solve the problem is to generate over all possible N-digit numbers and for each such number, check if all its digits satisfy the required condition or not.Time Complexity: O(10N*N)Auxiliary Space: O(1)Efficient Approach: To optimize the above approach, the idea is to use Dynamic Programming as it has overlapping subproblems and optimal substructure. The subproblems can be stored in dp[][] table using memoization, where dp[digit][mask] stores the answer from the digitth position till the end, when the included digits are represented using a mask. Follow the steps below to solve this problem:Define a recursive function, say countOfNumbers(digit, mask), and perform the following steps:Base Case: If the value of digit is equal to N+1, then check if the value of the mask is equal to (1 