Ugly Number II
Medium · Heap & Priority Queue · about 20 minutes
Asked at Google, Amazon, Microsoft, Bloomberg, Meta.
Call a positive integer *ugly* when 2, 3 and 5 are the only primes that divide it (1 is ugly too). Listing the ugly numbers in increasing order, return the n-th one.