[C++] Simple C++ Code || 90% time || Similar to Ugly Number II
If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.\n\nclass Solution {\npublic:\n
# **If you like the implementation then Please help me by increasing my reputation. By clicking the up arrow on the left of my image.**\n```\nclass Solution {\npublic:\n    int nthSuperUglyNumber(int n, vector<int>& primes) {\n        int m = primes.size();\n        vector<int> value(m,0);\n        vector<int> result(n+1,0);\n        result[0] = 1;\n        for(int i = 1; i < n; i++)\n        {\n            long long val = INT_MAX;\n            //vector<long long> store(m,0);\n            for(int j = 0; j < m; j++)\n            {\n                long long ans = (long long)result[value[j]]*(long long)primes[j];\n                //store[j] = ans;\n                val = min(ans, val);\n            }\n            for(int j = 0; j < m; j++)\n            {\n                if((long long)result[value[j]]*(long long)primes[j] == val)\n                    value[j]++;\n            }\n            result[i] = val;\n        }\n        return result[n-1];\n    }\n};\n```
['Dynamic Programming', 'C', 'C++']