Skip to content

Commit 0769aaf

Browse files
committed
Create README - LeetHub
1 parent ce46420 commit 0769aaf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/count-the-number-of-fair-pairs/">2699. Count the Number of Fair Pairs</a></h2><h3>Medium</h3><hr><p>Given a <strong>0-indexed</strong> integer array <code>nums</code> of size <code>n</code> and two integers <code>lower</code> and <code>upper</code>, return <em>the number of fair pairs</em>.</p>
2+
3+
<p>A pair <code>(i, j)</code> is <b>fair </b>if:</p>
4+
5+
<ul>
6+
<li><code>0 &lt;= i &lt; j &lt; n</code>, and</li>
7+
<li><code>lower &lt;= nums[i] + nums[j] &lt;= upper</code></li>
8+
</ul>
9+
10+
<p>&nbsp;</p>
11+
<p><strong class="example">Example 1:</strong></p>
12+
13+
<pre>
14+
<strong>Input:</strong> nums = [0,1,7,4,4,5], lower = 3, upper = 6
15+
<strong>Output:</strong> 6
16+
<strong>Explanation:</strong> There are 6 fair pairs: (0,3), (0,4), (0,5), (1,3), (1,4), and (1,5).
17+
</pre>
18+
19+
<p><strong class="example">Example 2:</strong></p>
20+
21+
<pre>
22+
<strong>Input:</strong> nums = [1,7,9,2,5], lower = 11, upper = 11
23+
<strong>Output:</strong> 1
24+
<strong>Explanation:</strong> There is a single fair pair: (2,3).
25+
</pre>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
32+
<li><code>nums.length == n</code></li>
33+
<li><code><font face="monospace">-10<sup>9</sup></font>&nbsp;&lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
34+
<li><code><font face="monospace">-10<sup>9</sup>&nbsp;&lt;= lower &lt;= upper &lt;= 10<sup>9</sup></font></code></li>
35+
</ul>

0 commit comments

Comments
 (0)