1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 21:16:45 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数数组 <code>nums</code> 和两个整数 <code>k</code> 和 <code>t</code> 。请你判断是否存在 <b>两个不同下标</b> <code>i</code> 和 <code>j</code>,使得 <code>abs(nums[i] - nums[j]) <= t</code> ,同时又满足 <code>abs(i - j) <= k</code><em> </em>。</p>\n\n<p>如果存在则返回 <code>true</code>,不存在返回 <code>false</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,1], k<em> </em>= 3, t = 0\n<strong>输出:</strong>true</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,0,1,1], k<em> </em>=<em> </em>1, t = 2\n<strong>输出:</strong>true</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,5,9,1,5,9], k = 2, t = 3\n<strong>输出:</strong>false</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= nums.length <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>-2<sup>31</sup> <= nums[i] <= 2<sup>31</sup> - 1</code></li>\n\t<li><code>0 <= k <= 10<sup>4</sup></code></li>\n\t<li><code>0 <= t <= 2<sup>31</sup> - 1</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 577,
"likes": 590,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Contains Duplicate\", \"titleSlug\": \"contains-duplicate\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u5b58\\u5728\\u91cd\\u590d\\u5143\\u7d20\"}, {\"title\": \"Contains Duplicate II\", \"titleSlug\": \"contains-duplicate-ii\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u5b58\\u5728\\u91cd\\u590d\\u5143\\u7d20 II\"}]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"74.7K\", \"totalSubmission\": \"258.5K\", \"totalAcceptedRaw\": 74663, \"totalSubmissionRaw\": 258544, \"acRate\": \"28.9%\"}",
"stats": "{\"totalAccepted\": \"76.7K\", \"totalSubmission\": \"265.3K\", \"totalAcceptedRaw\": 76671, \"totalSubmissionRaw\": 265295, \"acRate\": \"28.9%\"}",
"hints": [
"Time complexity O(n logk) - This will give an indication that sorting is involved for k elements.",
"Use already existing state to evaluate next state - Like, a set of k sorted numbers are only needed to be tracked. When we are processing the next number in array, then we can utilize the existing sorted state and it is not necessary to sort next overlapping set of k numbers again."