C++ Heap
\nclass Solution {\npublic:\n    int nthUglyNumber(int n) {\n        priority_queue<long> minHeap;\n        minHeap.push(-1 * 1);\n        int nth = 0;\n       
```\nclass Solution {\npublic:\n    int nthUglyNumber(int n) {\n        priority_queue<long> minHeap;\n        minHeap.push(-1 * 1);\n        int nth = 0;\n        long val = 1;\n        while (!minHeap.empty() && nth < n) {\n            val = -1 * minHeap.top();\n            minHeap.pop();\n            while (!minHeap.empty() && val == (-1 * minHeap.top())) {\n                minHeap.pop();\n            }\n            nth++;\n            minHeap.push(-1 * val * 2);\n            minHeap.push(-1 * val * 3);\n            minHeap.push(-1 * val * 5);\n        }\n        \n        return val;\n    }\n};\n```
['C', 'Heap (Priority Queue)']