Short Simple Using C++ Sets
\nclass Solution {\npublic:\n    int nthSuperUglyNumber(int n, vector<int>& primes) {\n        set<unsigned long long int>s;\n        unsigned long long int x;\
```\nclass Solution {\npublic:\n    int nthSuperUglyNumber(int n, vector<int>& primes) {\n        set<unsigned long long int>s;\n        unsigned long long int x;\n        s.insert(1);\n        while(n--)\n        {\n            x=*s.begin();\n            s.erase(s.begin());\n            for(auto it:primes)\n            {\n                if(x*it<=INT_MAX)\n                s.insert(x*it);\n                else\n                break;\n            }\n        }\n        return x;\n    }\n};\n```
[]