O( n)        JAVA---Easy version to understand!
    int getMin(int a,int b,int c){\n         int min=Integer.min(a,b);\n         min=Integer.min(min,c);\n         return min;\n    }\n    public int nthUglyNum
        int getMin(int a,int b,int c){\n         int min=Integer.min(a,b);\n         min=Integer.min(min,c);\n         return min;\n    }\n    public int nthUglyNumber(int n) {\n        if(n==1)\n          return 1;\n          int[] a=new int[n];\n        int p2=0,p3=0,p5=0,p=1,count=1;\n         a[0]=1;\n        while(count<n){\n            a[p]=getMin(a[p2]*2,a[p3]*3,a[p5]*5);\n            while(a[p2]*2<=a[p])\n               p2++;\n            while(a[p3]*3<=a[p])\n               p3++;\n            while(a[p5]*5<=a[p])\n               p5++;\n              \n              p++;\n              count++;\n        }\n        return a[--p];\n    }
[]