mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
36 lines
1.2 KiB
HTML
36 lines
1.2 KiB
HTML
<p>给你一个整数 <code>n</code> ,请你返回所有 0 到 1 之间(不包括 0 和 1)满足分母小于等于 <code>n</code> 的 <strong>最简 </strong>分数 。分数可以以 <strong>任意 </strong>顺序返回。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre><strong>输入:</strong>n = 2
|
||
<strong>输出:</strong>["1/2"]
|
||
<strong>解释:</strong>"1/2" 是唯一一个分母小于等于 2 的最简分数。</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre><strong>输入:</strong>n = 3
|
||
<strong>输出:</strong>["1/2","1/3","2/3"]
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre><strong>输入:</strong>n = 4
|
||
<strong>输出:</strong>["1/2","1/3","1/4","2/3","3/4"]
|
||
<strong>解释:</strong>"2/4" 不是最简分数,因为它可以化简为 "1/2" 。</pre>
|
||
|
||
<p><strong>示例 4:</strong></p>
|
||
|
||
<pre><strong>输入:</strong>n = 1
|
||
<strong>输出:</strong>[]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= n <= 100</code></li>
|
||
</ul>
|