c++ sol
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numDupDigitsAtMostN(int n) {\n        // we take n+1 number to make n inclusive in our algo\n        // in the algo we find number with  non repeated digits  and to calculate number with repeated digits we subtract it from n \n        int temp = n+1;\n        vector<int> digits ; // store the  digits;\n        while(temp>0)\n        {\n            int digit = temp % 10;\n            digits.push_back(digit);\n            temp/=10;\n        }\n        int countnonrepeatedno=0;\n        int countways= 9; // initally for most significan digit count will be 9 (exclude 0)\n        for(int  i =0;i< digits.size()-1; i++)\n        {\n            countnonrepeatedno += countways;\n            countways=countways*(9-i);\n        }\n        int m = digits.size();\n        //for further  possible ways remove the previous counts \n        countways/= 9;\n        // for second part \n        vector<int>fixed(10, 0);  // [0-9] digits so size =10 , we have taken this so that same element not processed again\n        for(int i = m-1; i>=0; i--)\n        {  int x= digits[i];\n           int j ;\n            if(i==m-1)\n            j=1;\n            else\n            j =0;\n          \n            while(j<x)\n            {\n                if(fixed[j]==0)\n                {\n                    countnonrepeatedno+= countways ;\n\n                }\n                j++;\n            }\n            countways/=(9-(m-i-1));\n             if(fixed[x]!=0)\n            break;\n            fixed[x]=1;\n\n        }\n        return  n - countnonrepeatedno;\n      \n\n\n    }\n};\n```
['C++']