1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-02 22:13:28 +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>n</code> 个整数的数组 <code>nums</code>,判断 <code>nums</code> 中是否存在三个元素 <em>abc </em>使得 <em>a + b + c = </em>0 ?请你找出所有和为 <code>0</code> 且不重复的三元组。</p>\n\n<p><strong>注意:</strong>答案中不可以包含重复的三元组。</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</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = []\n<strong>输出:</strong>[]\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0]\n<strong>输出:</strong>[]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= 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": 4551,
"likes": 4684,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Two Sum\", \"titleSlug\": \"two-sum\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u4e24\\u6570\\u4e4b\\u548c\"}, {\"title\": \"3Sum Closest\", \"titleSlug\": \"3sum-closest\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6700\\u63a5\\u8fd1\\u7684\\u4e09\\u6570\\u4e4b\\u548c\"}, {\"title\": \"4Sum\", \"titleSlug\": \"4sum\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u56db\\u6570\\u4e4b\\u548c\"}, {\"title\": \"3Sum Smaller\", \"titleSlug\": \"3sum-smaller\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8f83\\u5c0f\\u7684\\u4e09\\u6570\\u4e4b\\u548c\"}]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"881.2K\", \"totalSubmission\": \"2.5M\", \"totalAcceptedRaw\": 881201, \"totalSubmissionRaw\": 2520478, \"acRate\": \"35.0%\"}",
"stats": "{\"totalAccepted\": \"933.8K\", \"totalSubmission\": \"2.6M\", \"totalAcceptedRaw\": 933762, \"totalSubmissionRaw\": 2648110, \"acRate\": \"35.3%\"}",
"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 <pre>x</pre>, we have to scan the entire array to find the next number<pre>y</pre> which is <pre>value - x</pre> where value is the input parameter. Can we change our array somehow so that this search becomes faster?",