Heapq solution in python
\'\'\'\n\n    def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:         \n        nums = [1] + primes\n        s = set(nums)\n         \n        f
\'\'\'\n\n    def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:         \n        nums = [1] + primes\n        s = set(nums)\n         \n        for i in range(n):\n            num = heapq.heappop(nums)             \n            for prime in primes:\n                if num*prime not in s:\n                    heapq.heappush(nums, num*prime)\n                    s.add(num*prime)\n        \n        return num
[]