[C++] || Digit DP || Total - NonRepeating
bound variable ensures that we dont overshoot the given n value at any time.\n\n mask check which digits are taken and which are yet to be taken.\n\n pos tracks
* `bound` variable ensures that we dont overshoot the given `n` value at any time.\n\n* `mask` check which digits are taken and which are yet to be taken.\n\n* `pos` tracks the length of orignal number.\n\n```\nclass Solution {\npublic:\n    int dp[11][1025][2] ;\n    string ref ;\n    int solve(int pos, int mask , int bound){\n        if(pos >= ref.size()) return (mask != 0) ;\n        if(dp[pos][mask][bound] != -1) return dp[pos][mask][bound] ;\n        \n        int res = 0 , maxi = bound ? (ref[pos]-\'0\') : 9 ;\n        for(int i = 0 ; i <= maxi ; ++i ){\n            if(mask & (1 << i)) continue ;\n            int newMask = (!i and !mask) ? mask : mask | (1 << i) ; // dont put leading zeros\n            \n            if(bound) res += solve(pos + 1 , newMask , (ref[pos]-\'0\') == i) ;\n            else res += solve(pos + 1 , newMask , 0) ;\n        }\n        \n        return dp[pos][mask][bound] = res ;\n    }\n    \n    int numDupDigitsAtMostN(int n) {\n        memset(dp,-1,sizeof(dp)) ;\n        //answer will be total  positive integers - the ones where no repetition is allowed \n        ref = to_string(n);\n        int nonRepeating = solve(0,0,1) ;\n        return n - nonRepeating ;\n    }\n};\n```\n\n\n* [Refer This Video For Digit Dp Intro](https://www.youtube.com/watch?v=wWfGCIL0AfU)
['C']