C++ Using Set | simple min heap idea
\tint nthUglyNumber(int n) {\n        set s;\n        n--;\n        long long x=1;\n        while(n--)\n        {\n            s.insert(x2);\n            s.inse
\tint nthUglyNumber(int n) {\n        set<long long> s;\n        n--;\n        long long x=1;\n        while(n--)\n        {\n            s.insert(x*2);\n            s.insert(x*3);\n            s.insert(x*5);\n            x=*s.begin();\n            s.erase(s.begin());\n        }\n        return (int)x;\n    }
[]