mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-04 15:01:40 +08:00
国外版
This commit is contained in:
32
算法题(国外版)/simplified-fractions.html
Normal file
32
算法题(国外版)/simplified-fractions.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<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>
|
Reference in New Issue
Block a user