Find Nth Ugly Number

Given a number N, we have to write a code to find the Nth ugly number.

What is Ugly Numbers?

Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. In simple words, The number which can be represented as the product of 2, 3 and 5 are ugly numbers (2^i * 3^i * 5^i).

For Example –

Input : n = 10, Output : 12

12 is the 10th ugly number. The first 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12.

Note:  

1 is typically treated as an ugly number.

n does not exceed 1690.