Last updated
Was this helpful?
Last updated
Was this helpful?
https://leetcode.com/problems/ugly-number-ii
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.
Example 1:
Example 2:
Constraints:
1 <= n <= 1690
Key: TreeSet can replace PriorityQueue, if not repeated element is allowed.