mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
33 lines
1.1 KiB
HTML
33 lines
1.1 KiB
HTML
|
<p>Given an integer <code>n</code>, return <em>a list of all <strong>simplified</strong> fractions between </em><code>0</code><em> and </em><code>1</code><em> (exclusive) such that the denominator is less-than-or-equal-to </em><code>n</code>. You can return the answer in <strong>any order</strong>.</p>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong>Example 1:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> n = 2
|
||
|
<strong>Output:</strong> ["1/2"]
|
||
|
<strong>Explanation:</strong> "1/2" is the only unique fraction with a denominator less-than-or-equal-to 2.
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>Example 2:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> n = 3
|
||
|
<strong>Output:</strong> ["1/2","1/3","2/3"]
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>Example 3:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
<strong>Input:</strong> n = 4
|
||
|
<strong>Output:</strong> ["1/2","1/3","1/4","2/3","3/4"]
|
||
|
<strong>Explanation:</strong> "2/4" is not a simplified fraction because it can be simplified to "1/2".
|
||
|
</pre>
|
||
|
|
||
|
<p> </p>
|
||
|
<p><strong>Constraints:</strong></p>
|
||
|
|
||
|
<ul>
|
||
|
<li><code>1 <= n <= 100</code></li>
|
||
|
</ul>
|