|
| 1 | +<h2><a href="https://leetcode.com/problems/ugly-number-ii">264. Ugly Number II</a></h2><h3>Medium</h3><hr><p>An <strong>ugly number</strong> is a positive integer whose prime factors are limited to <code>2</code>, <code>3</code>, and <code>5</code>.</p> |
| 2 | + |
| 3 | +<p>Given an integer <code>n</code>, return <em>the</em> <code>n<sup>th</sup></code> <em><strong>ugly number</strong></em>.</p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<pre> |
| 9 | +<strong>Input:</strong> n = 10 |
| 10 | +<strong>Output:</strong> 12 |
| 11 | +<strong>Explanation:</strong> [1, 2, 3, 4, 5, 6, 8, 9, 10, 12] is the sequence of the first 10 ugly numbers. |
| 12 | +</pre> |
| 13 | + |
| 14 | +<p><strong class="example">Example 2:</strong></p> |
| 15 | + |
| 16 | +<pre> |
| 17 | +<strong>Input:</strong> n = 1 |
| 18 | +<strong>Output:</strong> 1 |
| 19 | +<strong>Explanation:</strong> 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5. |
| 20 | +</pre> |
| 21 | + |
| 22 | +<p> </p> |
| 23 | +<p><strong>Constraints:</strong></p> |
| 24 | + |
| 25 | +<ul> |
| 26 | + <li><code>1 <= n <= 1690</code></li> |
| 27 | +</ul> |
0 commit comments