Priority Queue || O(n + logn!) || C++ || Concise code
\nint nthUglyNumber(int n) {\n    priority_queue<long long, vector<long long>, greater<long long>> pq;\n    pq.push(1);\n    long long top;\n    while (n--) {\n
```\nint nthUglyNumber(int n) {\n    priority_queue<long long, vector<long long>, greater<long long>> pq;\n    pq.push(1);\n    long long top;\n    while (n--) {\n        top=pq.top();\n        while (!pq.empty() && pq.top()==top) {\n            pq.pop();\n        }\n        pq.push(top*2);\n        pq.push(top*3);\n        pq.push(top*5);\n    }\n    return top;\n}\n```
['C', 'Heap (Priority Queue)']