java 2ms easiest approach
\nclass Solution {\n    public int nthUglyNumber(int n) {\n        int c2 = 0,c3 = 0,c5 = 0;\n        int[] dp = new int[n+1];\n        dp[0] = 1;\n        for(
```\nclass Solution {\n    public int nthUglyNumber(int n) {\n        int c2 = 0,c3 = 0,c5 = 0;\n        int[] dp = new int[n+1];\n        dp[0] = 1;\n        for(int i=1;i<=n;i++)\n        {\n            dp[i] = Math.min(2*dp[c2],Math.min(3*dp[c3],dp[c5]*5));\n            if(dp[i] == 2*dp[c2])\n                c2++;\n            if(dp[i] == 3*dp[c3])\n                c3++;\n            if(dp[i] == 5*dp[c5])\n                c5++;\n        }\n        return dp[n-1];\n    }\n}\n```\nPlease upvote if u find my code easy to understand
['Dynamic Programming', 'Java']