My 8ms Java DP solution
My 8ms JAVA DP Solution\n\n  public int nthUglyNumber(int n) {\n        \n        if( n == 0 || n == 1) {\n            return n;\n        }\n        \n        i
My 8ms JAVA DP Solution\n\n  public int nthUglyNumber(int n) {\n        \n        if( n == 0 || n == 1) {\n            return n;\n        }\n        \n        int pointer2 = 0;\n        int pointer3 = 0;\n        int pointer5 = 0;\n        \n        int[] result = new int[n];\n        result[0] = 1;\n\n        int i = 1, min =0;\n        while ( i < n ) {\n            min = Math.min(result[pointer2]*2,Math.min(result[pointer3]*3,result[pointer5]*5));\n            \n            if(min == result[pointer2]*2) {\n                pointer2++;\n            }\n            if(min == result[pointer3]*3) {\n                pointer3++;\n            }\n            if(min == result[pointer5]*5) {\n                pointer5++;\n            }\n            result[i] = min;\n         \n            i++;\n            \n        }\n        return result[n-1];\n    }
[]