mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-12 10:51:42 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
<p>给定一个整数数组和一个整数 <code><strong>k</strong></code>,你需要在数组里找到<strong> 不同的 </strong>k-diff 数对,并返回不同的 <strong>k-diff 数对</strong> 的数目。</p>
|
||||
<p>给你一个整数数组 <code>nums</code> 和一个整数 <code>k</code>,请你在数组中找出<strong> 不同的 </strong>k-diff 数对,并返回不同的 <strong>k-diff 数对</strong> 的数目。</p>
|
||||
|
||||
<p>这里将 <strong>k-diff</strong> 数对定义为一个整数对 <code>(nums[i], nums[j])</code>,并满足下述全部条件:</p>
|
||||
<p><strong>k-diff</strong> 数对定义为一个整数对 <code>(nums[i], nums[j])</code><strong> </strong>,并满足下述全部条件:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>0 <= i < j < nums.length</code></li>
|
||||
<li><code>0 <= i, j < nums.length</code></li>
|
||||
<li><code>i != j</code></li>
|
||||
<li><code>|nums[i] - nums[j]| == k</code></li>
|
||||
</ul>
|
||||
|
||||
@@ -17,7 +18,7 @@
|
||||
<strong>输入:</strong>nums = [3, 1, 4, 1, 5], k = 2
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>数组中有两个 2-diff 数对, (1, 3) 和 (3, 5)。
|
||||
尽管数组中有两个1,但我们只应返回不同的数对的数量。
|
||||
尽管数组中有两个 1 ,但我们只应返回不同的数对的数量。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
@@ -25,7 +26,7 @@
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [1, 2, 3, 4, 5], k = 1
|
||||
<strong>输出:</strong>4
|
||||
<strong>解释:</strong>数组中有四个 1-diff 数对, (1, 2), (2, 3), (3, 4) 和 (4, 5)。
|
||||
<strong>解释:</strong>数组中有四个 1-diff 数对, (1, 2), (2, 3), (3, 4) 和 (4, 5) 。
|
||||
</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
@@ -33,7 +34,7 @@
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [1, 3, 1, 5, 4], k = 0
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>数组中只有一个 0-diff 数对,(1, 1)。
|
||||
<strong>解释:</strong>数组中只有一个 0-diff 数对,(1, 1) 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
Reference in New Issue
Block a user