AC C# solution, beats 90%
public class Solution {\n\n    public int NthUglyNumber(int n) {\n\n        int x = 0;  // Number used to generate the next ugly number by 2x\n        int y = 0
public class Solution {\n\n    public int NthUglyNumber(int n) {\n\n        int x = 0;  // Number used to generate the next ugly number by 2*x\n        int y = 0;  // Number used to generate the next ugly number by 3*y\n        int z = 0;  // Number used to generate the next ugly number by 5*z\n        \n        int[] ugly = new int[n];\n        \n        ugly[0] = 1;  \n        \n        int count = 0;\n        while( count < n-1){\n            int next = Math.Min(2*ugly[x], Math.Min(3*ugly[y], 5*ugly[z]));\n            ugly[++count] = next;\n            if(2*ugly[x] == next) x++;\n            if(3*ugly[y] == next) y++;\n            if(5*ugly[z] == next) z++;\n        }\n        \n        return ugly[n-1];\n    }\n}
[]