mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> ,判断是否存在三元组 <code>[nums[i], nums[j], nums[k]]</code> 满足 <code>i != j</code>、<code>i != k</code> 且 <code>j != k</code> ,同时还满足 <code>nums[i] + nums[j] + nums[k] == 0</code> 。请</p>\n\n<p>你返回所有和为 <code>0</code> 且不重复的三元组。</p>\n\n<p><strong>注意:</strong>答案中不可以包含重复的三元组。</p>\n\n<p> </p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [-1,0,1,2,-1,-4]\n<strong>输出:</strong>[[-1,-1,2],[-1,0,1]]\n<strong>解释:</strong>\nnums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0 。\nnums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0 。\nnums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0 。\n不同的三元组是 [-1,0,1] 和 [-1,-1,2] 。\n注意,输出的顺序和三元组的顺序并不重要。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,1,1]\n<strong>输出:</strong>[]\n<strong>解释:</strong>唯一可能的三元组和不为 0 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,0,0]\n<strong>输出:</strong>[[0,0,0]]\n<strong>解释:</strong>唯一可能的三元组和为 0 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= nums.length <= 3000</code></li>\n\t<li><code>-10<sup>5</sup> <= nums[i] <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 6577,
|
||||
"likes": 6579,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Two Sum\", \"titleSlug\": \"two-sum\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u4e24\\u6570\\u4e4b\\u548c\", \"isPaidOnly\": false}, {\"title\": \"3Sum Closest\", \"titleSlug\": \"3sum-closest\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u63a5\\u8fd1\\u7684\\u4e09\\u6570\\u4e4b\\u548c\", \"isPaidOnly\": false}, {\"title\": \"4Sum\", \"titleSlug\": \"4sum\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u56db\\u6570\\u4e4b\\u548c\", \"isPaidOnly\": false}, {\"title\": \"3Sum Smaller\", \"titleSlug\": \"3sum-smaller\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8f83\\u5c0f\\u7684\\u4e09\\u6570\\u4e4b\\u548c\", \"isPaidOnly\": true}]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.6M\", \"totalSubmission\": \"4.2M\", \"totalAcceptedRaw\": 1587519, \"totalSubmissionRaw\": 4230529, \"acRate\": \"37.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.6M\", \"totalSubmission\": \"4.2M\", \"totalAcceptedRaw\": 1587816, \"totalSubmissionRaw\": 4231168, \"acRate\": \"37.5%\"}",
|
||||
"hints": [
|
||||
"So, we essentially need to find three numbers x, y, and z such that they add up to the given value. If we fix one of the numbers say x, we are left with the two-sum problem at hand!",
|
||||
"For the two-sum problem, if we fix one of the numbers, say x, we have to scan the entire array to find the next number y, which is value - x where value is the input parameter. Can we change our array somehow so that this search becomes faster?",
|
||||
|
Reference in New Issue
Block a user