JAVA || easy to understand || DP solution
\nJust like the ugly number 2 question .\n\n\n# Code\n\nclass Solution {\n    public int nthSuperUglyNumber(int n, int[] primes) {\n       long dp[] = new long[
\nJust like the ugly number 2 question .\n\n\n# Code\n```\nclass Solution {\n    public int nthSuperUglyNumber(int n, int[] primes) {\n       long dp[] = new long[n+1];\n        int pointers[] = new int[primes.length];\n        dp[0] = 1;\n        for(int i =1;i<dp.length;i++){\n            dp[i] = Integer.MAX_VALUE;\n            for(int j =0;j<primes.length;j++){\n                dp[i] = Math.min(dp[i],dp[pointers[j]]*primes[j]);\n            }\n            for(int j =0;j<primes.length;j++){\n                if(dp[i] == dp[pointers[j]]*primes[j]){\n                    pointers[j]++;\n                }\n            }\n        }\n        return (int)dp[n-1];\n    }\n}\n```\nyou can check out my github repository where i am uploading famous interview questions topic wise with solutions.\u2028link-- \nhttps://github.com/AnkitaGoyalD2004?tab=repositories
['Java']