1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-12-17 17:52:34 +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> 。</p>\n\n<p>每一步操作中,你需要从数组中选出和为 <code>k</code> 的两个整数,并将它们移出数组。</p>\n\n<p>返回你可以对数组执行的最大操作数。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,4], k = 5\n<strong>输出:</strong>2\n<strong>解释:</strong>开始时 nums = [1,2,3,4]\n- 移出 1 和 4 ,之后 nums = [2,3]\n- 移出 2 和 3 ,之后 nums = []\n不再有和为 5 的数对,因此最多执行 2 次操作。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [3,1,3,4,3], k = 6\n<strong>输出:</strong>1\n<strong>解释:</strong>开始时 nums = [3,1,3,4,3]\n- 移出前两个 3 之后nums = [1,4,3]\n不再有和为 6 的数对,因此最多执行 1 次操作。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= nums[i] <= 10<sup>9</sup></code></li>\n\t<li><code>1 <= k <= 10<sup>9</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 24,
"likes": 25,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"15.9K\", \"totalAcceptedRaw\": 7980, \"totalSubmissionRaw\": 15865, \"acRate\": \"50.3%\"}",
"stats": "{\"totalAccepted\": \"8.2K\", \"totalSubmission\": \"16.2K\", \"totalAcceptedRaw\": 8203, \"totalSubmissionRaw\": 16212, \"acRate\": \"50.6%\"}",
"hints": [
"The abstract problem asks to count the number of disjoint pairs with a given sum k.",
"For each possible value x, it can be paired up with k - x.",