Simple Python, Only use heap
\nfrom heapq import heappush, heappop\nclass Solution:\n    def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:\n        \n        minheap = [1]\n  
```\nfrom heapq import heappush, heappop\nclass Solution:\n    def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:\n        \n        minheap = [1]\n        while n:\n            node = heappop(minheap)\n            #handle duplicates\n            while minheap and minheap[0] == node:\n                heappop(minheap)\n            n -= 1\n            for prime in primes:\n                heappush(minheap, node * prime)\n        \n        return node\n```
[]