1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 15:31:43 +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>给定一个 <strong>排序好</strong> 的数组&nbsp;<code>arr</code> ,两个整数 <code>k</code> 和 <code>x</code> ,从数组中找到最靠近 <code>x</code>(两数之差最小)的 <code>k</code> 个数。返回的结果必须要是按升序排好的。</p>\n\n<p>整数 <code>a</code> 比整数 <code>b</code> 更接近 <code>x</code> 需要满足:</p>\n\n<ul>\n\t<li><code>|a - x| &lt; |b - x|</code> 或者</li>\n\t<li><code>|a - x| == |b - x|</code> 且 <code>a &lt; b</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,2,3,4,5], k = 4, x = 3\n<strong>输出:</strong>[1,2,3,4]\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,2,3,4,5], k = 4, x = -1\n<strong>输出:</strong>[1,2,3,4]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= k &lt;= arr.length</code></li>\n\t<li><code>1 &lt;= arr.length&nbsp;&lt;= 10<sup>4</sup></code><meta charset=\"UTF-8\" /></li>\n\t<li><code>arr</code>&nbsp;按 <strong>升序</strong> 排列</li>\n\t<li><code>-10<sup>4</sup>&nbsp;&lt;= arr[i], x &lt;= 10<sup>4</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 304,
"likes": 313,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Guess Number Higher or Lower\", \"titleSlug\": \"guess-number-higher-or-lower\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u731c\\u6570\\u5b57\\u5927\\u5c0f\"}, {\"title\": \"Guess Number Higher or Lower II\", \"titleSlug\": \"guess-number-higher-or-lower-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u731c\\u6570\\u5b57\\u5927\\u5c0f II\"}, {\"title\": \"Find K-th Smallest Pair Distance\", \"titleSlug\": \"find-k-th-smallest-pair-distance\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u627e\\u51fa\\u7b2c k \\u5c0f\\u7684\\u8ddd\\u79bb\\u5bf9\"}]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"34.3K\", \"totalSubmission\": \"75.2K\", \"totalAcceptedRaw\": 34276, \"totalSubmissionRaw\": 75181, \"acRate\": \"45.6%\"}",
"stats": "{\"totalAccepted\": \"36.5K\", \"totalSubmission\": \"79.9K\", \"totalAcceptedRaw\": 36455, \"totalSubmissionRaw\": 79861, \"acRate\": \"45.6%\"}",
"hints": [],
"solution": null,
"status": null,