Java || DP
\nclass Solution {\n    \n    public int nthSuperUglyNumber(int n, int[] primes) {\n        int[] pointers = new int[primes.length];\n        Arrays.fill(pointe
```\nclass Solution {\n    \n    public int nthSuperUglyNumber(int n, int[] primes) {\n        int[] pointers = new int[primes.length];\n        Arrays.fill(pointers, 1);\n        \n        int[] dp = new int[n + 1];\n        dp[0] = 0;\n        dp[1] = 1;\n        int idx = 2;\n        \n        while(idx < dp.length){\n        \n            int min = Integer.MAX_VALUE;\n            for(int i=0; i<primes.length; i++){\n                int comp = primes[i] * dp[pointers[i]];\n                if(min > comp){\n                    min = comp;\n                }\n            }\n            \n            \n            \n            dp[idx] = min;\n            \n            for(int i=0; i<primes.length; i++){\n                int comp = primes[i] * dp[pointers[i]];\n                if(min == comp){\n                    pointers[i]++;\n                }\n            }\n            \n            idx++;\n        }\n        \n        return dp[n];\n    }\n}\n```
[]