My view of this question - hope it can help you understand!!!
It is actually like how we merge k sorted list:\n\nugly number                       k sorted list\n    1                            2     7    13   19     1 * 
It is actually like how we merge k sorted list:\n``` \nugly number                       k sorted list\n    1                            2     7    13   19     1 * [2,7,13,19]\n    |                            |     |    |    |\n    2                            4     14   26   38     2 * [2,7,13,19]\n    |                            |     |    |    |\n    4                            8     28   52   76     4 * [2,7,13,19]\n    |                            |     |    |    |              \n    7                            14    49   91   133    7 * [2,7,13,19]\n    |                            |     |    |    |\n    8                            16    56   ...   ...   8 * [2,7,13,19]\n    |                            |     |    |     |\n    .                            .     .     .    .\n    .                            .     .     .    .\n    .                            .     .     .    .\n```\n\nWe can see that each prime number in ```primes[]``` form a sorted list, and now our job is to merge them and find the ```nth``` minimum.\n\nHere we don\'t have the ```next``` pointer for each node to trace the next potential candidate. But as we can see in the graph, we can make use of the ugly number we have produced so far!\n\nI just refer the @zorro77\'s solution here:\n```\nclass Solution {\n    public int nthSuperUglyNumber(int n, int[] primes) {\n        PriorityQueue<int[]> queue=new PriorityQueue<>((a,b)->(a[0]-b[0]));\n        for (int i=0;i<primes.length;i++)\n            queue.offer(new int[]{primes[i], primes[i], 0});\n\n        int[] nums=new int[n+1];\n        nums[0]=1;\n        \n        int i=1;\n        while (i<n){\n            int[] entry=queue.poll();\n            int num=entry[0], prime=entry[1], index=entry[2];\n\t\t\t// remove duplicate\n            if (num!=nums[i-1]){\n                nums[i]=num;\n                i++;\n            }\n            queue.offer(new int[]{prime*nums[index+1], prime, index+1});\n        }\n        return nums[n-1];\n    }\n}\n```\n\nHere, each entry has three parts: ```{num, prime, index}```, ```num``` represents the value of the node, ```prime``` means which sorted list this node is in, and ```index``` tells us how far we have gone in that list, it works like the ```next``` pointer in linkedlist, help us find the next node in that sorted list.\n\nTime: ```O(nlogk)```\nSpace: ```O(n+k)```\n
[]