Simple cpp code with own explanation
int nthSuperUglyNumber(int n, vector<int>& primes) {\n        // The same idea as Ugly number II. Use primes and priveious ugly number to calcute. In this quest
    int nthSuperUglyNumber(int n, vector<int>& primes) {\n        // The same idea as Ugly number II. Use primes and priveious ugly number to calcute. In this question, there are vector of pramaters for calculation. So I need an array of idx, idx[i] mark for the last position I use that ith primes to caluate the ugly number.\n        vector<int>ugly(n);\n        vector<int>index(primes.size());\n        ugly[0] = 1;\n        for (int j = 1; j < n; j++) {\n            int res = INT_MAX;\n            for (int i = 0; i < primes.size(); i++) {\n                res = min(res, primes[i] * ugly[index[i]]);\n            }\n            for (int i = 0; i < primes.size(); i++) {\n                if (res == primes[i] * ugly[index[i]]) {\n                    index[i]++;\n                }\n            }\n            ugly[j] = res;\n        }\n        return ugly[n - 1];\n    }
[]