C++ Digit Dp solution
"""\n\n    //dp[pos][tight][start][rep][mask];\n    int dp[10][2][2][2][1<<10];\n    vectornum;\n    int solve(int pos,int tight,int start,int rep,int mask)\n  
"""\n\n    //dp[pos][tight][start][rep][mask];\n    int dp[10][2][2][2][1<<10];\n    vector<int>num;\n    int solve(int pos,int tight,int start,int rep,int mask)\n    {\n        if(pos == num.size())\n        {\n            return rep;\n        }\n        int &ans= dp[pos][tight][start][rep][mask];\n        if(ans!=-1)return ans;\n        \n        int k = num[pos];\n        if(tight)k=9;\n        int res=0;\n        for(int i=0;i<=k;i++)\n        {\n            int ns = start||i>0;//number started yet or not\n            int nt = tight||i<k;//tight for next number\n            if(ns){\n                res+=solve(pos+1,nt,ns,rep||(mask&(1<<i)),mask|1<<i);\n            }\n            else{\n                res+=solve(pos+1,nt,0,rep,mask);\n            }\n        \n        }\n        ans= res;\n        return res;\n    }\n    int numDupDigitsAtMostN(int N) {\n        while(N){\n            num.push_back(N%10);\n            N/=10;\n        }\n        reverse(num.begin(),num.end());\n        memset(dp,-1,sizeof(dp));\n        return solve(0,0,0,0,0);\n    }\n}\n"""
[]