1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/丑数 [ugly-number].html
2022-03-29 12:43:11 +08:00

36 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p><strong>丑数 </strong>就是只包含质因数&nbsp;<code>2</code><code>3</code><code>5</code>&nbsp;的正整数。</p>
<p>给你一个整数 <code>n</code> ,请你判断 <code>n</code> 是否为 <strong>丑数</strong> 。如果是,返回 <code>true</code> ;否则,返回 <code>false</code></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>n = 6
<strong>输出:</strong>true
<strong>解释:</strong>6 = 2 × 3</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>n = 1
<strong>输出:</strong>true
<strong>解释:</strong>1 没有质因数,因此它的全部质因数是 {2, 3, 5} 的空集。习惯上将其视作第一个丑数。</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>n = 14
<strong>输出:</strong>false
<strong>解释:</strong>14 不是丑数,因为它包含了另外一个质因数&nbsp;<code>7 </code>
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>-2<sup>31</sup> &lt;= n &lt;= 2<sup>31</sup> - 1</code></li>
</ul>