# Ugly Number II

Ugly number is a number that only have factors `2`

, `3`

and `5`

. Design an algorithm to find the nth ugly number. The first 10 ugly numbers are `1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ...`

Example

```
n Result
1 1
2 2
9 10
```

Ugly number is a number that only have factors `2`

, `3`

and `5`

. Design an algorithm to find the nth ugly number. The first 10 ugly numbers are `1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ...`

Example

```
n Result
1 1
2 2
9 10
```