mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -7,12 +7,12 @@
|
||||
"boundTopicId": 2054,
|
||||
"title": "3Sum With Multiplicity",
|
||||
"titleSlug": "3sum-with-multiplicity",
|
||||
"content": "<p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i < j < k</code> and <code>arr[i] + arr[j] + arr[k] == target</code>.</p>\n\n<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,3,3,4,4,5,5], target = 8\n<strong>Output:</strong> 20\n<strong>Explanation: </strong>\nEnumerating by the values (arr[i], arr[j], arr[k]):\n(1, 2, 5) occurs 8 times;\n(1, 3, 4) occurs 8 times;\n(2, 2, 4) occurs 2 times;\n(2, 3, 3) occurs 2 times.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,2,2], target = 5\n<strong>Output:</strong> 12\n<strong>Explanation: </strong>\narr[i] = 1, arr[j] = arr[k] = 2 occurs 12 times:\nWe choose one 1 from [1,1] in 2 ways,\nand two 2s from [2,2,2,2] in 6 ways.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 3000</code></li>\n\t<li><code>0 <= arr[i] <= 100</code></li>\n\t<li><code>0 <= target <= 300</code></li>\n</ul>\n",
|
||||
"content": "<p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i < j < k</code> and <code>arr[i] + arr[j] + arr[k] == target</code>.</p>\n\n<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,3,3,4,4,5,5], target = 8\n<strong>Output:</strong> 20\n<strong>Explanation: </strong>\nEnumerating by the values (arr[i], arr[j], arr[k]):\n(1, 2, 5) occurs 8 times;\n(1, 3, 4) occurs 8 times;\n(2, 2, 4) occurs 2 times;\n(2, 3, 3) occurs 2 times.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,2,2], target = 5\n<strong>Output:</strong> 12\n<strong>Explanation: </strong>\narr[i] = 1, arr[j] = arr[k] = 2 occurs 12 times:\nWe choose one 1 from [1,1] in 2 ways,\nand two 2s from [2,2,2,2] in 6 ways.\n</pre>\n\n<p><strong>Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [2,1,3], target = 6\n<strong>Output:</strong> 1\n<strong>Explanation:</strong> (1, 2, 3) occured one time in the array so we return 1.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 3000</code></li>\n\t<li><code>0 <= arr[i] <= 100</code></li>\n\t<li><code>0 <= target <= 300</code></li>\n</ul>\n",
|
||||
"translatedTitle": "三数之和的多种可能",
|
||||
"translatedContent": "<p>给定一个整数数组<meta charset=\"UTF-8\" /> <code>arr</code> ,以及一个整数 <code>target</code> 作为目标值,返回满足 <code>i < j < k</code> 且<meta charset=\"UTF-8\" /> <code>arr[i] + arr[j] + arr[k] == target</code> 的元组 <code>i, j, k</code> 的数量。</p>\n\n<p>由于结果会非常大,请返回 <code>10<sup>9</sup> + 7</code> 的模。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,1,2,2,3,3,4,4,5,5], target = 8\n<strong>输出:</strong>20\n<strong>解释:</strong>\n按值枚举(arr[i], arr[j], arr[k]):\n(1, 2, 5) 出现 8 次;\n(1, 3, 4) 出现 8 次;\n(2, 2, 4) 出现 2 次;\n(2, 3, 3) 出现 2 次。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,1,2,2,2,2], target = 5\n<strong>输出:</strong>12\n<strong>解释:</strong>\narr[i] = 1, arr[j] = arr[k] = 2 出现 12 次:\n我们从 [1,1] 中选择一个 1,有 2 种情况,\n从 [2,2,2,2] 中选出两个 2,有 6 种情况。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 3000</code></li>\n\t<li><code>0 <= arr[i] <= 100</code></li>\n\t<li><code>0 <= target <= 300</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 93,
|
||||
"likes": 94,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"20.8K\", \"totalAcceptedRaw\": 7247, \"totalSubmissionRaw\": 20790, \"acRate\": \"34.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.5K\", \"totalSubmission\": \"21.4K\", \"totalAcceptedRaw\": 7536, \"totalSubmissionRaw\": 21396, \"acRate\": \"35.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
@@ -179,7 +179,7 @@
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"exampleTestcases": "[1,1,2,2,3,3,4,4,5,5]\n8\n[1,1,2,2,2,2]\n5",
|
||||
"exampleTestcases": "[1,1,2,2,3,3,4,4,5,5]\n8\n[1,1,2,2,2,2]\n5\n[2,1,3]\n6",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user