C++ solution with STL set
int nthUglyNumber(int n) {\n        set<long long> isUgly;\n        isUgly.insert(1);\n        long long top = 0;\n        for(int i=0; i<n; i++){\n            
    int nthUglyNumber(int n) {\n        set<long long> isUgly;\n        isUgly.insert(1);\n        long long top = 0;\n        for(int i=0; i<n; i++){\n            top = *isUgly.lower_bound(top+1);\n            isUgly.insert(top*2);\n            isUgly.insert(top*3);\n            isUgly.insert(top*5);\n            \n        }\n        return top;\n    }
['C++']