DP solution | C++
int nthUglyNumber(int n) {\n        \n        if(n <= 0)\n\t\t return false; \n        if(n == 1) \n\t\t return true; \n        int t2 = 0, t3 = 0, t5 = 0; //po
int nthUglyNumber(int n) {\n        \n        if(n <= 0)\n\t\t return false; \n        if(n == 1) \n\t\t return true; \n        int t2 = 0, t3 = 0, t5 = 0; //pointers for 2, 3, 5\n        vector<int> k(n);\n        k[0] = 1;\n        for(int i  = 1; i < n ; i ++)\n        {\n            k[i] = min(k[t2]*2,min(k[t3]*3,k[t5]*5));\n            if(k[i] == k[t2]*2) \n             t2++; \n            if(k[i] == k[t3]*3) \n             t3++;\n            if(k[i] == k[t5]*5) \n             t5++;\n        }\n        return k[n-1];\n        \n        \n    }
[]