Python Heap
\nclass Solution(object):\n    def nthUglyNumber(self, n):\n        """\n        :type n: int\n        :rtype: int\n        """\n        heap = [1]\n        vis
```\nclass Solution(object):\n    def nthUglyNumber(self, n):\n        """\n        :type n: int\n        :rtype: int\n        """\n        heap = [1]\n        visited = set([1])\n        \n        for i in range(n):\n            val = heapq.heappop(heap)\n            \n            for factor in [2,3,5]:\n                if val*factor not in visited:\n                    heapq.heappush(heap, val*factor)\n                    visited.add(val*factor)\n        \n        \n        return val\n```
[]