Practice Ugly Number II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, return the nth ugly number.
Source: Ugly Number II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 10
Output
12
# Example 2
Input
n = 1
Output
1
Constraints
1 <= n <= 1690
Related LeetCode Problems
Practice more problems similar to Ugly Number II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.