c++ | easy | short
\n\n# Code\n\nclass Solution {\npublic:\nint nthSuperUglyNumber(int n, vector<int>& primes) {\n        vector<int>arri(primes.size());\n  vector<long>arrn(prime
\n\n# Code\n```\nclass Solution {\npublic:\nint nthSuperUglyNumber(int n, vector<int>& primes) {\n        vector<int>arri(primes.size());\n  vector<long>arrn(primes.size());\n    vector<long>dp(n+1);\n    dp[0]=1;\n    for(int j=0;j<n;j++){\n        long  mini=INT_MAX;\n        for(int i=0;i<arri.size();i++){\n            arrn[i]=dp[arri[i]]*primes[i];\n            mini=min(mini,arrn[i]);\n        }\n      for(int i=0;i<arri.size();i++){\n          if(mini==arrn[i]){\n              dp[j+1]=arrn[i];\n              arri[i]++;\n          }\n      }\n  \n    }\n\n  return dp[n-1]; \n}\n};\n```
['C++']