Python Straightforward O(nklogk) time, O(n) space solution
\nfrom heapq import *\nclass Solution(object):\n    def nthSuperUglyNumber(self, n, primes):\n        """\n        :type n: int\n        :type primes: List[int]
```\nfrom heapq import *\nclass Solution(object):\n    def nthSuperUglyNumber(self, n, primes):\n        """\n        :type n: int\n        :type primes: List[int]\n        :rtype: int\n        """\n        nums=[]\n        heap=[]\n        seen={1,}\n        heappush(heap,1)\n        \n        for _ in range(n):\n            curr_ugly=heappop(heap)\n            nums.append(curr_ugly)\n            for prime in primes:\n                new_ugly=curr_ugly*prime\n                if new_ugly not in seen:\n                    seen.add(new_ugly)\n                    heappush(heap,new_ugly)\n        \n        return nums[-1]\n```
['Heap (Priority Queue)', 'Python']