1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-27 18:50:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/算法题(国内版)/problem (Chinese)/最简分数 [simplified-fractions].html

36 lines
1.2 KiB
HTML
Raw Normal View History

2022-03-27 20:37:52 +08:00
<p>给你一个整数&nbsp;<code>n</code>&nbsp;,请你返回所有 0 到 1 之间(不包括 0 和 1满足分母小于等于&nbsp;&nbsp;<code>n</code>&nbsp;<strong>最简&nbsp;</strong>分数&nbsp;。分数可以以 <strong>任意&nbsp;</strong>顺序返回。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>n = 2
<strong>输出:</strong>[&quot;1/2&quot;]
<strong>解释:</strong>&quot;1/2&quot; 是唯一一个分母小于等于 2 的最简分数。</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>n = 3
<strong>输出:</strong>[&quot;1/2&quot;,&quot;1/3&quot;,&quot;2/3&quot;]
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>n = 4
<strong>输出:</strong>[&quot;1/2&quot;,&quot;1/3&quot;,&quot;1/4&quot;,&quot;2/3&quot;,&quot;3/4&quot;]
<strong>解释:</strong>&quot;2/4&quot; 不是最简分数,因为它可以化简为 &quot;1/2&quot;</pre>
<p><strong>示例 4</strong></p>
<pre><strong>输入:</strong>n = 1
<strong>输出:</strong>[]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 100</code></li>
</ul>