mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 23:11:41 +08:00
国外版
This commit is contained in:
35
算法题(国外版)/ugly-number.html
Normal file
35
算法题(国外版)/ugly-number.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<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>
|
||||
|
||||
<p>Given an integer <code>n</code>, return <code>true</code> <em>if</em> <code>n</code> <em>is an <strong>ugly number</strong></em>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> n = 6
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation:</strong> 6 = 2 × 3
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> n = 1
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation:</strong> 1 has no prime factors, therefore all of its prime factors are limited to 2, 3, and 5.
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> n = 14
|
||||
<strong>Output:</strong> false
|
||||
<strong>Explanation:</strong> 14 is not ugly since it includes the prime factor 7.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>-2<sup>31</sup> <= n <= 2<sup>31</sup> - 1</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user