Ugly Number II Problem
Ugly Number II Problem — ExecCode Medium DSA Practice
Solve the Ugly Number II problem on ExecCode. Free online medium DSA practice in Heap. Write and run code in Java, C++, Python — no signup required to run.
Problem description
An ugly number is a positive integer whose only prime factors are 2, 3, and 5. Given an integer n, return the nᵗʰ ugly number, counting 1 as the first ugly number in the sequence.
Examples
Input n = 10; Output 12. Input n = 1; Output 1. Input n = 15; Output 24
Constraints
1 ≤ n ≤ 1690
Practice Ugly Number II free on ExecCode. Browse DSA problems, topic map, and placement guides.