Problem statement

https://binarysearch.com/problems/Increasing-Digits/

Solution

We can just use combinatorics here to get direct formula.

Complexity

It is O(1) for time and space.

Code

class Solution:
    def solve(self, n):
        if n == 10: return 0
        return factorial(9)//factorial(n)//factorial(9 - n)