[C++] Let Backtracking do it's work , clean and crisp code
\nclass Solution {\npublic:\n    int dfs(long curr, int mask, int n) {\n        if(curr > n) return 0;\n        int ans=1; //since n < 123456789 and all its per
```\nclass Solution {\npublic:\n    int dfs(long curr, int mask, int n) {\n        if(curr > n) return 0;\n        int ans=1; //since n < 123456789 and all its permutations therefore 1 number always exists\n        for(int i=0; i<10; i++) {\n            if(!mask and !i) continue; //leading 0 not allowed\n            if(mask & (1<<i)) continue; //repetition not allowed\n            ans+=dfs(curr*10+i,mask+(1<<i),n);\n        }\n        return ans;\n    }\n    \n    int numDupDigitsAtMostN(int n) {\n        return n+1-dfs(0,0,n);\n    }\n};\n```
['Backtracking', 'Depth-First Search', 'C', 'Bitmask', 'C++']