1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
程序员小墨 2022-03-29 16:56:27 +08:00
parent e730aa6794
commit ad15da05aa
2517 changed files with 7358 additions and 7332 deletions

View File

@ -1,23 +1,46 @@
# 力扣题库(完整版)
使用 Python 脚本分批将力扣(国外版 `leetcode.com` 和 国内版 `leetcode-cn.com`)上面的题目下载下来,方便没有网的时候进行学习。
### 仓库内容介绍
- [x] 国外版力扣题库,在仓库 `leetcode` 文件夹下(其中的 html 文件)。
- [x] 国内版力扣题库,在仓库 `leetcode-cn/problem (Chinese)` 文件夹下,对于同时有英文版的题目来说,英文版在仓库 `leetcode-cn/problem (English)` 文件夹下。
### 一些说明
- 仅包含可以在网页上直接打开的公开题目,不包含 VIP 题目。
- 当前仓库的最后更新日期为 `2022.03.29`,我们会每隔一段时间从官方网站进行题目同步。
> **注意!**
> 最后更新日期: **2022.03.29**
>
> **所有版权都为 LeetCode (及力扣中国) 官方所有,此处仅供学习使用,感谢 LeetCode 平台为我们提供大量的算法题目进行练习、提升。也请大家不要滥用,不要侵犯力扣平台的合法权益。**
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件
---
### 仓库介绍
使用 Python 脚本分批将力扣(`leetcode.com` 和 `leetcode-cn.com`)上面的题目保存下来,方便没有网的时候进行学习。(仅包含可以在网页上直接打开的公开题目,不包含 VIP 题目)
### 仓库目录结构
国外版力扣题库,在仓库 `leetcode/problem` 文件夹下;国内版力扣题库,在仓库 `leetcode-cn/problem (Chinese)``leetcode-cn/problem (English)` 文件夹下。(部分题目只有中文版,无对应英文版)。
### 特别注意!
#### 版权相关
**所有版权都为 LeetCode (及力扣中国) 官方所有,此处仅供学习使用,不要他用。也请大家不要滥用,不要侵犯力扣平台的合法权益。**
**感谢 LeetCode 平台为我们提供大量的算法题目进行练习与提升。如果大家经济条件允许,请大家多多支持力扣,例如冲冲会员等。**
力扣题库的权益归属力扣,使用力扣题库,需要遵循力扣使用条例,若您不同意此条例,请立即关闭当前网页,不要继续使用本题库。
力扣LeetCode• 使用条例: https://leetcode-cn.com/terms-c/
LeetCode Terms of Service https://leetcode.com/terms/
#### 脚本原作者
Python脚本是在网上教程的基础上进行二改得到的原版地址https://blog.csdn.net/weixin_37267014/article/details/81429057
#### 其他
由于脚本运行时会向力扣网站发出大量请求,所以请大家不要随便尝试此脚本,以免影响力扣网站正常运行。
因为使用此脚本所造成的一系列问题,责任由您自己承担,作者不承担相应责任。
Python脚本是在网上教程的基础上进行二改得到的原版地址https://blog.csdn.net/weixin_37267014/article/details/81429057

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"93.7K\", \"totalSubmission\": \"203.8K\", \"totalAcceptedRaw\": 93669, \"totalSubmissionRaw\": 203796, \"acRate\": \"46.0%\"}",
"stats": "{\"totalAccepted\": \"94.1K\", \"totalSubmission\": \"204.7K\", \"totalAcceptedRaw\": 94106, \"totalSubmissionRaw\": 204670, \"acRate\": \"46.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"2.7K\", \"totalAcceptedRaw\": 1121, \"totalSubmissionRaw\": 2724, \"acRate\": \"41.2%\"}",
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"2.7K\", \"totalAcceptedRaw\": 1128, \"totalSubmissionRaw\": 2731, \"acRate\": \"41.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"12.9K\", \"totalAcceptedRaw\": 9135, \"totalSubmissionRaw\": 12949, \"acRate\": \"70.5%\"}",
"stats": "{\"totalAccepted\": \"9.3K\", \"totalSubmission\": \"13.1K\", \"totalAcceptedRaw\": 9262, \"totalSubmissionRaw\": 13114, \"acRate\": \"70.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.2K\", \"totalSubmission\": \"11.3K\", \"totalAcceptedRaw\": 8152, \"totalSubmissionRaw\": 11256, \"acRate\": \"72.4%\"}",
"stats": "{\"totalAccepted\": \"8.3K\", \"totalSubmission\": \"11.5K\", \"totalAcceptedRaw\": 8298, \"totalSubmissionRaw\": 11454, \"acRate\": \"72.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 5098, \"totalSubmissionRaw\": 9699, \"acRate\": \"52.6%\"}",
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 5108, \"totalSubmissionRaw\": 9716, \"acRate\": \"52.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.4K\", \"totalSubmission\": \"11.7K\", \"totalAcceptedRaw\": 7378, \"totalSubmissionRaw\": 11675, \"acRate\": \"63.2%\"}",
"stats": "{\"totalAccepted\": \"7.5K\", \"totalSubmission\": \"11.9K\", \"totalAcceptedRaw\": 7467, \"totalSubmissionRaw\": 11855, \"acRate\": \"63.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定非负整数数组 <code>heights</code>&nbsp;,数组中的数字用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 <code>1</code> 。</p>\n\n<p>求在该柱状图中,能够勾勒出来的矩形的最大面积。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2021/01/04/histogram.jpg\" /></p>\n\n<pre>\n<strong>输入:</strong>heights = [2,1,5,6,2,3]\n<strong>输出:</strong>10\n<strong>解释:</strong>最大的矩形为图中红色区域,面积为 10\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2021/01/04/histogram-1.jpg\" /></p>\n\n<pre>\n<strong>输入:</strong> heights = [2,4]\n<b>输出:</b> 4</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= heights.length &lt;=10<sup>5</sup></code></li>\n\t<li><code>0 &lt;= heights[i] &lt;= 10<sup>4</sup></code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 84&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/largest-rectangle-in-histogram/\">https://leetcode-cn.com/problems/largest-rectangle-in-histogram/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 30,
"likes": 32,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 8978, \"totalSubmissionRaw\": 17894, \"acRate\": \"50.2%\"}",
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"18.1K\", \"totalAcceptedRaw\": 9091, \"totalSubmissionRaw\": 18120, \"acRate\": \"50.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -137,7 +137,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"61.3K\", \"totalSubmission\": \"110.6K\", \"totalAcceptedRaw\": 61301, \"totalSubmissionRaw\": 110598, \"acRate\": \"55.4%\"}",
"stats": "{\"totalAccepted\": \"61.3K\", \"totalSubmission\": \"110.7K\", \"totalAcceptedRaw\": 61347, \"totalSubmissionRaw\": 110677, \"acRate\": \"55.4%\"}",
"hints": [
"Keep track of where the next character starts. At the end, you want to know if you started on the last bit."
],

View File

@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"63.1K\", \"totalSubmission\": \"174.1K\", \"totalAcceptedRaw\": 63076, \"totalSubmissionRaw\": 174054, \"acRate\": \"36.2%\"}",
"stats": "{\"totalAccepted\": \"63.2K\", \"totalSubmission\": \"174.3K\", \"totalAcceptedRaw\": 63155, \"totalSubmissionRaw\": 174266, \"acRate\": \"36.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个包含 <code>n</code> 个整数的数组&nbsp;<code>nums</code>,判断&nbsp;<code>nums</code>&nbsp;中是否存在三个元素&nbsp;<code>a</code> <code>b</code> <code>c</code> <em></em>使得&nbsp;<code>a + b + c = 0</code> ?请找出所有和为 <code>0</code> 且&nbsp;<strong>不重复&nbsp;</strong>的三元组。</p>\n\n<p>&nbsp;</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>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 &lt;= nums.length &lt;= 3000</code></li>\n\t<li><code>-10<sup>5</sup> &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 15&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/3sum/\">https://leetcode-cn.com/problems/3sum/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 45,
"likes": 46,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"21.5K\", \"totalSubmission\": \"48.4K\", \"totalAcceptedRaw\": 21515, \"totalSubmissionRaw\": 48407, \"acRate\": \"44.4%\"}",
"stats": "{\"totalAccepted\": \"21.8K\", \"totalSubmission\": \"49.1K\", \"totalAcceptedRaw\": 21786, \"totalSubmissionRaw\": 49105, \"acRate\": \"44.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>输入一个整数 <code>n</code> 求1n这n个整数的十进制表示中1出现的次数。</p>\n\n<p>例如输入12112这些整数中包含1 的数字有1、10、11和121一共出现了5次。</p>\n\n<p> </p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 12\n<strong>输出:</strong>5\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 13\n<strong>输出:</strong>6</pre>\n\n<p> </p>\n\n<p><strong>限制:</strong></p>\n\n<ul>\n\t<li><code>1 <= n < 2^31</code></li>\n</ul>\n\n<p>注意:本题与主站 233 题相同:<a href=\"https://leetcode-cn.com/problems/number-of-digit-one/\">https://leetcode-cn.com/problems/number-of-digit-one/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 302,
"likes": 305,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"62.2K\", \"totalSubmission\": \"125.1K\", \"totalAcceptedRaw\": 62157, \"totalSubmissionRaw\": 125071, \"acRate\": \"49.7%\"}",
"stats": "{\"totalAccepted\": \"62.4K\", \"totalSubmission\": \"125.5K\", \"totalAcceptedRaw\": 62375, \"totalSubmissionRaw\": 125453, \"acRate\": \"49.7%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"54.5K\", \"totalSubmission\": \"95.7K\", \"totalAcceptedRaw\": 54494, \"totalSubmissionRaw\": 95702, \"acRate\": \"56.9%\"}",
"stats": "{\"totalAccepted\": \"54.6K\", \"totalSubmission\": \"95.9K\", \"totalAcceptedRaw\": 54596, \"totalSubmissionRaw\": 95857, \"acRate\": \"57.0%\"}",
"hints": [
"How many characters may be there in the clipboard at the last step if n = 3? n = 7? n = 10? n = 24?"
],

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.1K\", \"totalSubmission\": \"7.7K\", \"totalAcceptedRaw\": 4140, \"totalSubmissionRaw\": 7740, \"acRate\": \"53.5%\"}",
"stats": "{\"totalAccepted\": \"4.2K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 4205, \"totalSubmissionRaw\": 7854, \"acRate\": \"53.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"30K\", \"totalSubmission\": \"55.4K\", \"totalAcceptedRaw\": 29956, \"totalSubmissionRaw\": 55412, \"acRate\": \"54.1%\"}",
"stats": "{\"totalAccepted\": \"30K\", \"totalSubmission\": \"55.5K\", \"totalAcceptedRaw\": 30034, \"totalSubmissionRaw\": 55545, \"acRate\": \"54.1%\"}",
"hints": [],
"solution": {
"id": "148",

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.7K\", \"totalSubmission\": \"8.7K\", \"totalAcceptedRaw\": 6652, \"totalSubmissionRaw\": 8720, \"acRate\": \"76.3%\"}",
"stats": "{\"totalAccepted\": \"6.8K\", \"totalSubmission\": \"8.8K\", \"totalAcceptedRaw\": 6754, \"totalSubmissionRaw\": 8850, \"acRate\": \"76.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个含有&nbsp;<code>n</code><strong>&nbsp;</strong>个正整数的数组和一个正整数 <code>target</code><strong> 。</strong></p>\n\n<p>找出该数组中满足其和<strong> </strong><code>&ge; target</code><strong> </strong>的长度最小的 <strong>连续子数组</strong>&nbsp;<code>[nums<sub>l</sub>, nums<sub>l+1</sub>, ..., nums<sub>r-1</sub>, nums<sub>r</sub>]</code> ,并返回其长度<strong>。</strong>如果不存在符合条件的子数组,返回 <code>0</code> 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>target = 7, nums = [2,3,1,2,4,3]\n<strong>输出:</strong>2\n<strong>解释:</strong>子数组&nbsp;<code>[4,3]</code>&nbsp;是该条件下的长度最小的子数组。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>target = 4, nums = [1,4,4]\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>target = 11, nums = [1,1,1,1,1,1,1,1]\n<strong>输出:</strong>0\n</pre>\n\n<p>&nbsp;</p>\n\n<p>提示:</p>\n\n<ul>\n\t<li><code>1 &lt;= target &lt;= 10<sup>9</sup></code></li>\n\t<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>1 &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p>进阶:</p>\n\n<ul>\n\t<li>如果你已经实现<em> </em><code>O(n)</code> 时间复杂度的解法, 请尝试设计一个 <code>O(n log(n))</code> 时间复杂度的解法。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 209&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/minimum-size-subarray-sum/\">https://leetcode-cn.com/problems/minimum-size-subarray-sum/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 49,
"likes": 51,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"21.7K\", \"totalSubmission\": \"44.2K\", \"totalAcceptedRaw\": 21711, \"totalSubmissionRaw\": 44181, \"acRate\": \"49.1%\"}",
"stats": "{\"totalAccepted\": \"22K\", \"totalSubmission\": \"44.8K\", \"totalAcceptedRaw\": 21996, \"totalSubmissionRaw\": 44778, \"acRate\": \"49.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个由 <code>0</code> 和 <code>1</code> 组成的矩阵 <code>mat</code>&nbsp;,请输出一个大小相同的矩阵,其中每一个格子是 <code>mat</code> 中对应位置元素到最近的 <code>0</code> 的距离。</p>\n\n<p>两个相邻元素间的距离为 <code>1</code> 。</p>\n\n<p>&nbsp;</p>\n\n<p><b>示例 1</b></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1626667201-NCWmuP-image.png\" style=\"width: 150px; \" /></p>\n\n<pre>\n<strong>输入:</strong>mat =<strong> </strong>[[0,0,0],[0,1,0],[0,0,0]]\n<strong>输出:</strong>[[0,0,0],[0,1,0],[0,0,0]]\n</pre>\n\n<p><b>示例 2</b></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1626667205-xFxIeK-image.png\" style=\"width: 150px; \" /></p>\n\n<pre>\n<b>输入:</b>mat =<b> </b>[[0,0,0],[0,1,0],[1,1,1]]\n<strong>输出:</strong>[[0,0,0],[0,1,0],[1,2,1]]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == mat.length</code></li>\n\t<li><code>n == mat[i].length</code></li>\n\t<li><code>1 &lt;= m, n &lt;= 10<sup>4</sup></code></li>\n\t<li><code>1 &lt;= m * n &lt;= 10<sup>4</sup></code></li>\n\t<li><code>mat[i][j] is either 0 or 1.</code></li>\n\t<li><code>mat</code> 中至少有一个 <code>0&nbsp;</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 542&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/01-matrix/\">https://leetcode-cn.com/problems/01-matrix/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 16,
"likes": 17,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"8.4K\", \"totalAcceptedRaw\": 4436, \"totalSubmissionRaw\": 8357, \"acRate\": \"53.1%\"}",
"stats": "{\"totalAccepted\": \"4.5K\", \"totalSubmission\": \"8.5K\", \"totalAcceptedRaw\": 4506, \"totalSubmissionRaw\": 8529, \"acRate\": \"52.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"20K\", \"totalSubmission\": \"68.1K\", \"totalAcceptedRaw\": 20002, \"totalSubmissionRaw\": 68085, \"acRate\": \"29.4%\"}",
"stats": "{\"totalAccepted\": \"20K\", \"totalSubmission\": \"68.2K\", \"totalAcceptedRaw\": 20027, \"totalSubmissionRaw\": 68174, \"acRate\": \"29.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"13.8K\", \"totalAcceptedRaw\": 10444, \"totalSubmissionRaw\": 13830, \"acRate\": \"75.5%\"}",
"stats": "{\"totalAccepted\": \"10.6K\", \"totalSubmission\": \"14K\", \"totalAcceptedRaw\": 10589, \"totalSubmissionRaw\": 14027, \"acRate\": \"75.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个长度为 <code>n</code> 的整数数组&nbsp;<code>nums</code><em>&nbsp;</em>和 一个目标值&nbsp;<code>target</code>。请你从 <code>nums</code><em> </em>中选出三个整数,使它们的和与&nbsp;<code>target</code>&nbsp;最接近。</p>\n\n<p>返回这三个数的和。</p>\n\n<p>假定每组输入只存在恰好一个解。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [-1,2,1,-4], target = 1\n<strong>输出:</strong>2\n<strong>解释:</strong>与 target 最接近的和是 2 (-1 + 2 + 1 = 2) 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,0,0], target = 1\n<strong>输出:</strong>0\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 &lt;= nums.length &lt;= 1000</code></li>\n\t<li><code>-1000 &lt;= nums[i] &lt;= 1000</code></li>\n\t<li><code>-10<sup>4</sup> &lt;= target &lt;= 10<sup>4</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 1087,
"likes": 1088,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"3Sum\", \"titleSlug\": \"3sum\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u4e09\\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\": \"326.9K\", \"totalSubmission\": \"714.5K\", \"totalAcceptedRaw\": 326866, \"totalSubmissionRaw\": 714522, \"acRate\": \"45.7%\"}",
"stats": "{\"totalAccepted\": \"327.9K\", \"totalSubmission\": \"716.9K\", \"totalAcceptedRaw\": 327937, \"totalSubmissionRaw\": 716886, \"acRate\": \"45.7%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"20.8K\", \"totalAcceptedRaw\": 7235, \"totalSubmissionRaw\": 20755, \"acRate\": \"34.9%\"}",
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"20.8K\", \"totalAcceptedRaw\": 7247, \"totalSubmissionRaw\": 20790, \"acRate\": \"34.9%\"}",
"hints": [],
"solution": null,
"status": null,

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": 4540,
"likes": 4551,
"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\": \"876.8K\", \"totalSubmission\": \"2.5M\", \"totalAcceptedRaw\": 876785, \"totalSubmissionRaw\": 2510558, \"acRate\": \"34.9%\"}",
"stats": "{\"totalAccepted\": \"881.2K\", \"totalSubmission\": \"2.5M\", \"totalAcceptedRaw\": 881201, \"totalSubmissionRaw\": 2520478, \"acRate\": \"35.0%\"}",
"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?",

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定两个单链表的头节点&nbsp;<code>headA</code> 和 <code>headB</code> ,请找出并返回两个单链表相交的起始节点。如果两个链表没有交点,返回 <code>null</code> 。</p>\n\n<p>图示两个链表在节点 <code>c1</code> 开始相交<strong></strong></p>\n\n<p><a href=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/14/160_statement.png\" target=\"_blank\"><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/14/160_statement.png\" style=\"height: 130px; width: 400px;\" /></a></p>\n\n<p>题目数据 <strong>保证</strong> 整个链式结构中不存在环。</p>\n\n<p><strong>注意</strong>,函数返回结果后,链表必须 <strong>保持其原始结构</strong> 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><a href=\"https://assets.leetcode.com/uploads/2018/12/13/160_example_1.png\" target=\"_blank\"><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/14/160_example_1.png\" style=\"height: 130px; width: 400px;\" /></a></p>\n\n<pre>\n<strong>输入:</strong>intersectVal = 8, listA = [4,1,8,4,5], listB = [5,0,1,8,4,5], skipA = 2, skipB = 3\n<strong>输出:</strong>Intersected at &#39;8&#39;\n<strong>解释:</strong>相交节点的值为 8 (注意,如果两个链表相交则不能为 0。\n从各自的表头开始算起链表 A 为 [4,1,8,4,5],链表 B 为 [5,0,1,8,4,5]。\n在 A 中,相交节点前有 2 个节点;在 B 中,相交节点前有 3 个节点。\n</pre>\n\n<p><strong>示例&nbsp;2</strong></p>\n\n<p><a href=\"https://assets.leetcode.com/uploads/2018/12/13/160_example_2.png\" target=\"_blank\"><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/14/160_example_2.png\" style=\"height: 136px; width: 350px;\" /></a></p>\n\n<pre>\n<strong>输入:</strong>intersectVal&nbsp;= 2, listA = [0,9,1,2,4], listB = [3,2,4], skipA = 3, skipB = 1\n<strong>输出:</strong>Intersected at &#39;2&#39;\n<strong>解释:</strong>相交节点的值为 2 (注意,如果两个链表相交则不能为 0。\n从各自的表头开始算起链表 A 为 [0,9,1,2,4],链表 B 为 [3,2,4]。\n在 A 中,相交节点前有 3 个节点;在 B 中,相交节点前有 1 个节点。\n</pre>\n\n<p><strong>示例&nbsp;3</strong></p>\n\n<p><a href=\"https://assets.leetcode.com/uploads/2018/12/13/160_example_3.png\" target=\"_blank\"><img alt=\"\" src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/12/14/160_example_3.png\" style=\"height: 126px; width: 200px;\" /></a></p>\n\n<pre>\n<strong>输入:</strong>intersectVal = 0, listA = [2,6,4], listB = [1,5], skipA = 3, skipB = 2\n<strong>输出:</strong>null\n<strong>解释:</strong>从各自的表头开始算起,链表 A 为 [2,6,4],链表 B 为 [1,5]。\n由于这两个链表不相交所以 intersectVal 必须为 0而 skipA 和 skipB 可以是任意值。\n这两个链表不相交因此返回 null 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>listA</code> 中节点数目为 <code>m</code></li>\n\t<li><code>listB</code> 中节点数目为 <code>n</code></li>\n\t<li><code>0 &lt;= m, n &lt;= 3 * 10<sup>4</sup></code></li>\n\t<li><code>1 &lt;= Node.val &lt;= 10<sup>5</sup></code></li>\n\t<li><code>0 &lt;= skipA &lt;= m</code></li>\n\t<li><code>0 &lt;= skipB &lt;= n</code></li>\n\t<li>如果 <code>listA</code> 和 <code>listB</code> 没有交点,<code>intersectVal</code> 为 <code>0</code></li>\n\t<li>如果 <code>listA</code> 和 <code>listB</code> 有交点,<code>intersectVal == listA[skipA + 1] == listB[skipB + 1]</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>进阶:</strong>能否设计一个时间复杂度 <code>O(n)</code> 、仅用 <code>O(1)</code> 内存的解决方案?</p>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 160&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/intersection-of-two-linked-lists/\">https://leetcode-cn.com/problems/intersection-of-two-linked-lists/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 30,
"likes": 31,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -132,7 +132,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"16.7K\", \"totalSubmission\": \"23.8K\", \"totalAcceptedRaw\": 16666, \"totalSubmissionRaw\": 23848, \"acRate\": \"69.9%\"}",
"stats": "{\"totalAccepted\": \"16.9K\", \"totalSubmission\": \"24.2K\", \"totalAcceptedRaw\": 16898, \"totalSubmissionRaw\": 24197, \"acRate\": \"69.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 8954, \"totalSubmissionRaw\": 13708, \"acRate\": \"65.3%\"}",
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 9054, \"totalSubmissionRaw\": 13869, \"acRate\": \"65.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给你四个整数数组 <code>nums1</code>、<code>nums2</code>、<code>nums3</code> 和 <code>nums4</code> ,数组长度都是 <code>n</code> ,请你计算有多少个元组 <code>(i, j, k, l)</code> 能满足:</p>\n\n<ul>\n\t<li><code>0 &lt;= i, j, k, l &lt; n</code></li>\n\t<li><code>nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums1 = [1,2], nums2 = [-2,-1], nums3 = [-1,2], nums4 = [0,2]\n<strong>输出:</strong>2\n<strong>解释:</strong>\n两个元组如下\n1. (0, 0, 0, 1) -&gt; nums1[0] + nums2[0] + nums3[0] + nums4[1] = 1 + (-2) + (-1) + 2 = 0\n2. (1, 1, 0, 0) -&gt; nums1[1] + nums2[1] + nums3[0] + nums4[0] = 2 + (-1) + (-1) + 0 = 0\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums1 = [0], nums2 = [0], nums3 = [0], nums4 = [0]\n<strong>输出:</strong>1\n</pre>\n\n<p>&nbsp;</p>\n\n<p>&nbsp; <strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == nums1.length</code></li>\n\t<li><code>n == nums2.length</code></li>\n\t<li><code>n == nums3.length</code></li>\n\t<li><code>n == nums4.length</code></li>\n\t<li><code>1 &lt;= n &lt;= 200</code></li>\n\t<li><code>-2<sup>28</sup> &lt;= nums1[i], nums2[i], nums3[i], nums4[i] &lt;= 2<sup>28</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 528,
"likes": 531,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"4Sum\", \"titleSlug\": \"4sum\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u56db\\u6570\\u4e4b\\u548c\"}]",
@ -143,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"108.2K\", \"totalSubmission\": \"174K\", \"totalAcceptedRaw\": 108201, \"totalSubmissionRaw\": 174028, \"acRate\": \"62.2%\"}",
"stats": "{\"totalAccepted\": \"108.7K\", \"totalSubmission\": \"174.8K\", \"totalAcceptedRaw\": 108734, \"totalSubmissionRaw\": 174813, \"acRate\": \"62.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个由 <code>n</code> 个整数组成的数组&nbsp;<code>nums</code> ,和一个目标值 <code>target</code> 。请你找出并返回满足下述全部条件且<strong>不重复</strong>的四元组&nbsp;<code>[nums[a], nums[b], nums[c], nums[d]]</code>&nbsp;(若两个四元组元素一一对应,则认为两个四元组重复):</p>\n\n<ul>\n\t<li><code>0 &lt;= a, b, c, d&nbsp;&lt; n</code></li>\n\t<li><code>a</code>、<code>b</code>、<code>c</code> 和 <code>d</code> <strong>互不相同</strong></li>\n\t<li><code>nums[a] + nums[b] + nums[c] + nums[d] == target</code></li>\n</ul>\n\n<p>你可以按 <strong>任意顺序</strong> 返回答案 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,0,-1,0,-2,2], target = 0\n<strong>输出:</strong>[[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,2,2,2,2], target = 8\n<strong>输出:</strong>[[2,2,2,2]]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 200</code></li>\n\t<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>\n\t<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 1171,
"likes": 1174,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[{\"title\": \"Two Sum\", \"titleSlug\": \"two-sum\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u4e24\\u6570\\u4e4b\\u548c\"}, {\"title\": \"3Sum\", \"titleSlug\": \"3sum\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u4e09\\u6570\\u4e4b\\u548c\"}, {\"title\": \"4Sum II\", \"titleSlug\": \"4sum-ii\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u56db\\u6570\\u76f8\\u52a0 II\"}]",
@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"288.2K\", \"totalSubmission\": \"733.5K\", \"totalAcceptedRaw\": 288244, \"totalSubmissionRaw\": 733497, \"acRate\": \"39.3%\"}",
"stats": "{\"totalAccepted\": \"289.4K\", \"totalSubmission\": \"736.4K\", \"totalAcceptedRaw\": 289382, \"totalSubmissionRaw\": 736414, \"acRate\": \"39.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定<strong>循环单调非递减列表</strong>中的一个点,写一个函数向这个列表中插入一个新元素&nbsp;<code>insertVal</code> ,使这个列表仍然是循环升序的。</p>\n\n<p>给定的可以是这个列表中任意一个顶点的指针,并不一定是这个列表中最小元素的指针。</p>\n\n<p>如果有多个满足条件的插入位置,可以选择任意一个位置插入新的值,插入后整个列表仍然保持有序。</p>\n\n<p>如果列表为空(给定的节点是 <code>null</code>),需要创建一个循环有序列表并返回这个节点。否则。请返回原先给定的节点。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2019/01/19/example_1_before_65p.jpg\" style=\"height: 149px; width: 250px;\" /><br />\n&nbsp;</p>\n\n<pre>\n<strong>输入:</strong>head = [3,4,1], insertVal = 2\n<strong>输出:</strong>[3,4,1,2]\n<strong>解释:</strong>在上图中,有一个包含三个元素的循环有序列表,你获得值为 3 的节点的指针,我们需要向表中插入元素 2 。新插入的节点应该在 1 和 3 之间,插入之后,整个列表如上图所示,最后返回节点 3 。\n\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2019/01/19/example_1_after_65p.jpg\" style=\"height: 149px; width: 250px;\" />\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>head = [], insertVal = 1\n<strong>输出:</strong>[1]\n<strong>解释:</strong>列表为空(给定的节点是 <code>null</code>),创建一个循环有序列表并返回这个节点。\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>head = [1], insertVal = 0\n<strong>输出:</strong>[1,0]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 &lt;= Number of Nodes &lt;= 5 * 10^4</code></li>\n\t<li><code><font face=\"monospace\">-10^6 &lt;= Node.val &lt;= 10^6</font></code></li>\n\t<li><code>-10^6 &lt;=&nbsp;insertVal &lt;= 10^6</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 708&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/insert-into-a-sorted-circular-linked-list/\">https://leetcode-cn.com/problems/insert-into-a-sorted-circular-linked-list/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 34,
"likes": 36,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -120,7 +120,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.7K\", \"totalSubmission\": \"31.8K\", \"totalAcceptedRaw\": 9743, \"totalSubmissionRaw\": 31847, \"acRate\": \"30.6%\"}",
"stats": "{\"totalAccepted\": \"9.9K\", \"totalSubmission\": \"32.2K\", \"totalAcceptedRaw\": 9866, \"totalSubmissionRaw\": 32242, \"acRate\": \"30.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -155,7 +155,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"13.5K\", \"totalSubmission\": \"45.1K\", \"totalAcceptedRaw\": 13502, \"totalSubmissionRaw\": 45139, \"acRate\": \"29.9%\"}",
"stats": "{\"totalAccepted\": \"13.6K\", \"totalSubmission\": \"45.3K\", \"totalAcceptedRaw\": 13569, \"totalSubmissionRaw\": 45283, \"acRate\": \"30.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 10111, \"totalSubmissionRaw\": 15147, \"acRate\": \"66.8%\"}",
"stats": "{\"totalAccepted\": \"10.2K\", \"totalSubmission\": \"15.4K\", \"totalAcceptedRaw\": 10232, \"totalSubmissionRaw\": 15357, \"acRate\": \"66.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.9K\", \"totalSubmission\": \"14.8K\", \"totalAcceptedRaw\": 8950, \"totalSubmissionRaw\": 14774, \"acRate\": \"60.6%\"}",
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"15K\", \"totalAcceptedRaw\": 9085, \"totalSubmissionRaw\": 14985, \"acRate\": \"60.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>树可以看成是一个连通且 <strong>无环&nbsp;</strong>的&nbsp;<strong>无向&nbsp;</strong>图。</p>\n\n<p>给定往一棵&nbsp;<code>n</code> 个节点 (节点值&nbsp;<code>1n</code>) 的树中添加一条边后的图。添加的边的两个顶点包含在 <code>1</code> 到 <code>n</code>&nbsp;中间,且这条附加的边不属于树中已存在的边。图的信息记录于长度为 <code>n</code> 的二维数组 <code>edges</code>&nbsp;<code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code>&nbsp;表示图中在 <code>ai</code> 和 <code>bi</code> 之间存在一条边。</p>\n\n<p>请找出一条可以删去的边,删除后可使得剩余部分是一个有着 <code>n</code> 个节点的树。如果有多个答案,则返回数组&nbsp;<code>edges</code>&nbsp;中最后出现的边。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1626676174-hOEVUL-image.png\" style=\"width: 152px; \" /></p>\n\n<pre>\n<strong>输入:</strong> edges = [[1,2],[1,3],[2,3]]\n<strong>输出:</strong> [2,3]\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1626676179-kGxcmu-image.png\" style=\"width: 250px; \" /></p>\n\n<pre>\n<strong>输入:</strong> edges = [[1,2],[2,3],[3,4],[1,4],[1,5]]\n<strong>输出:</strong> [1,4]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == edges.length</code></li>\n\t<li><code>3 &lt;= n &lt;= 1000</code></li>\n\t<li><code>edges[i].length == 2</code></li>\n\t<li><code>1 &lt;= ai&nbsp;&lt; bi&nbsp;&lt;= edges.length</code></li>\n\t<li><code>ai != bi</code></li>\n\t<li><code>edges</code> 中无重复元素</li>\n\t<li>给定的图是连通的&nbsp;</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 684&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/redundant-connection/\">https://leetcode-cn.com/problems/redundant-connection/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 17,
"likes": 18,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"5.1K\", \"totalAcceptedRaw\": 3524, \"totalSubmissionRaw\": 5090, \"acRate\": \"69.2%\"}",
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"5.2K\", \"totalAcceptedRaw\": 3577, \"totalSubmissionRaw\": 5154, \"acRate\": \"69.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定链表的头结点&nbsp;<code>head</code>&nbsp;,请将其按 <strong>升序</strong> 排列并返回 <strong>排序后的链表</strong> 。</p>\n\n<ul>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/09/14/sort_list_1.jpg\" style=\"width: 302px; \" /></p>\n\n<pre>\n<b>输入:</b>head = [4,2,1,3]\n<b>输出:</b>[1,2,3,4]\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/09/14/sort_list_2.jpg\" style=\"width: 402px; \" /></p>\n\n<pre>\n<b>输入:</b>head = [-1,5,3,4,0]\n<b>输出:</b>[-1,0,3,4,5]\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<b>输入:</b>head = []\n<b>输出:</b>[]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><b>提示:</b></p>\n\n<ul>\n\t<li>链表中节点的数目在范围&nbsp;<code>[0, 5 * 10<sup>4</sup>]</code>&nbsp;内</li>\n\t<li><code>-10<sup>5</sup>&nbsp;&lt;= Node.val &lt;= 10<sup>5</sup></code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><b>进阶:</b>你可以在&nbsp;<code>O(n&nbsp;log&nbsp;n)</code> 时间复杂度和常数级空间复杂度下,对链表进行排序吗?</p>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 148&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/sort-list/\">https://leetcode-cn.com/problems/sort-list/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 43,
"likes": 44,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"12.8K\", \"totalSubmission\": \"21K\", \"totalAcceptedRaw\": 12753, \"totalSubmissionRaw\": 20968, \"acRate\": \"60.8%\"}",
"stats": "{\"totalAccepted\": \"12.9K\", \"totalSubmission\": \"21.2K\", \"totalAcceptedRaw\": 12897, \"totalSubmissionRaw\": 21218, \"acRate\": \"60.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"17.5K\", \"totalAcceptedRaw\": 6141, \"totalSubmissionRaw\": 17545, \"acRate\": \"35.0%\"}",
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"17.8K\", \"totalAcceptedRaw\": 6224, \"totalSubmissionRaw\": 17806, \"acRate\": \"35.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个可包含重复数字的整数集合&nbsp;<code>nums</code> <strong>按任意顺序</strong> 返回它所有不重复的全排列。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,1,2]\n<strong>输出:</strong>\n[[1,1,2],\n [1,2,1],\n [2,1,1]]\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3]\n<strong>输出:</strong>[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 8</code></li>\n\t<li><code>-10 &lt;= nums[i] &lt;= 10</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 47&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/permutations-ii/\">https://leetcode-cn.com/problems/permutations-ii/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 15,
"likes": 17,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.6K\", \"totalSubmission\": \"12.4K\", \"totalAcceptedRaw\": 8553, \"totalSubmissionRaw\": 12394, \"acRate\": \"69.0%\"}",
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"12.6K\", \"totalAcceptedRaw\": 8678, \"totalSubmissionRaw\": 12567, \"acRate\": \"69.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"642\", \"totalSubmission\": \"1K\", \"totalAcceptedRaw\": 642, \"totalSubmissionRaw\": 1049, \"acRate\": \"61.2%\"}",
"stats": "{\"totalAccepted\": \"646\", \"totalSubmission\": \"1.1K\", \"totalAcceptedRaw\": 646, \"totalSubmissionRaw\": 1053, \"acRate\": \"61.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.2K\", \"totalSubmission\": \"18K\", \"totalAcceptedRaw\": 10164, \"totalSubmissionRaw\": 17964, \"acRate\": \"56.6%\"}",
"stats": "{\"totalAccepted\": \"10.3K\", \"totalSubmission\": \"18.2K\", \"totalAcceptedRaw\": 10292, \"totalSubmissionRaw\": 18173, \"acRate\": \"56.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个二进制数组 <code>nums</code> , 找到含有相同数量的 <code>0</code> 和 <code>1</code> 的最长连续子数组,并返回该子数组的长度。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [0,1]\n<strong>输出:</strong> 2\n<strong>说明:</strong> [0, 1] 是具有相同数量 0 和 1 的最长连续子数组。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [0,1,0]\n<strong>输出:</strong> 2\n<strong>说明:</strong> [0, 1] (或 [1, 0]) 是具有相同数量 0 和 1 的最长连续子数组。</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 525&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/contiguous-array/\">https://leetcode-cn.com/problems/contiguous-array/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 48,
"likes": 49,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"15K\", \"totalSubmission\": \"26.7K\", \"totalAcceptedRaw\": 14964, \"totalSubmissionRaw\": 26713, \"acRate\": \"56.0%\"}",
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"27.1K\", \"totalAcceptedRaw\": 15146, \"totalSubmissionRaw\": 27117, \"acRate\": \"55.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"44.2K\", \"totalSubmission\": \"61.8K\", \"totalAcceptedRaw\": 44171, \"totalSubmissionRaw\": 61849, \"acRate\": \"71.4%\"}",
"stats": "{\"totalAccepted\": \"44.3K\", \"totalSubmission\": \"62.1K\", \"totalAcceptedRaw\": 44329, \"totalSubmissionRaw\": 62077, \"acRate\": \"71.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.6K\", \"totalSubmission\": \"7.8K\", \"totalAcceptedRaw\": 4620, \"totalSubmissionRaw\": 7800, \"acRate\": \"59.2%\"}",
"stats": "{\"totalAccepted\": \"4.7K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 4677, \"totalSubmissionRaw\": 7900, \"acRate\": \"59.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.6K\", \"totalSubmission\": \"3.5K\", \"totalAcceptedRaw\": 1560, \"totalSubmissionRaw\": 3528, \"acRate\": \"44.2%\"}",
"stats": "{\"totalAccepted\": \"1.6K\", \"totalSubmission\": \"3.5K\", \"totalAcceptedRaw\": 1568, \"totalSubmissionRaw\": 3540, \"acRate\": \"44.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"2.1K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 2147, \"totalSubmissionRaw\": 7925, \"acRate\": \"27.1%\"}",
"stats": "{\"totalAccepted\": \"2.2K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 2153, \"totalSubmissionRaw\": 7935, \"acRate\": \"27.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.5K\", \"totalSubmission\": \"15.7K\", \"totalAcceptedRaw\": 8547, \"totalSubmissionRaw\": 15725, \"acRate\": \"54.4%\"}",
"stats": "{\"totalAccepted\": \"8.6K\", \"totalSubmission\": \"15.9K\", \"totalAcceptedRaw\": 8637, \"totalSubmissionRaw\": 15891, \"acRate\": \"54.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"14.9K\", \"totalAcceptedRaw\": 9111, \"totalSubmissionRaw\": 14881, \"acRate\": \"61.2%\"}",
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 9248, \"totalSubmissionRaw\": 15115, \"acRate\": \"61.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>数组的每个下标作为一个阶梯,第 <code>i</code> 个阶梯对应着一个非负数的体力花费值&nbsp;<code>cost[i]</code>(下标从 <code>0</code> 开始)。</p>\n\n<p>每当爬上一个阶梯都要花费对应的体力值,一旦支付了相应的体力值,就可以选择向上爬一个阶梯或者爬两个阶梯。</p>\n\n<p>请找出达到楼层顶部的最低花费。在开始时,你可以选择从下标为 0 或 1 的元素作为初始阶梯。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例&nbsp;1</strong></p>\n\n<pre>\n<strong>输入:</strong>cost = [10, 15, 20]\n<strong>输出:</strong>15\n<strong>解释:</strong>最低花费是从 cost[1] 开始,然后走两步即可到阶梯顶,一共花费 15 。\n</pre>\n\n<p><strong>&nbsp;示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]\n<strong>输出:</strong>6\n<strong>解释:</strong>最低花费方式是从 cost[0] 开始,逐个经过那些 1 ,跳过 cost[3] ,一共花费 6 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= cost.length &lt;= 1000</code></li>\n\t<li><code>0 &lt;= cost[i] &lt;= 999</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 746&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/min-cost-climbing-stairs/\">https://leetcode-cn.com/problems/min-cost-climbing-stairs/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 34,
"likes": 35,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"13K\", \"totalSubmission\": \"17.6K\", \"totalAcceptedRaw\": 13033, \"totalSubmissionRaw\": 17648, \"acRate\": \"73.8%\"}",
"stats": "{\"totalAccepted\": \"13.3K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 13257, \"totalSubmissionRaw\": 17936, \"acRate\": \"73.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"4.5K\", \"totalAcceptedRaw\": 2852, \"totalSubmissionRaw\": 4499, \"acRate\": \"63.4%\"}",
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"4.6K\", \"totalAcceptedRaw\": 2911, \"totalSubmissionRaw\": 4595, \"acRate\": \"63.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>写一个&nbsp;<code>RecentCounter</code>&nbsp;类来计算特定时间范围内最近的请求。</p>\n\n<p>请实现 <code>RecentCounter</code> 类:</p>\n\n<ul>\n\t<li><code>RecentCounter()</code> 初始化计数器,请求数为 0 。</li>\n\t<li><code>int ping(int t)</code> 在时间 <code>t</code> 添加一个新请求,其中 <code>t</code> 表示以毫秒为单位的某个时间,并返回过去 <code>3000</code> 毫秒内发生的所有请求数(包括新请求)。确切地说,返回在 <code>[t-3000, t]</code> 内发生的请求数。</li>\n</ul>\n\n<p><strong>保证</strong> 每次对 <code>ping</code> 的调用都使用比之前更大的 <code>t</code> 值。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入:</strong>\ninputs = [&quot;RecentCounter&quot;, &quot;ping&quot;, &quot;ping&quot;, &quot;ping&quot;, &quot;ping&quot;]\ninputs = [[], [1], [100], [3001], [3002]]\n<strong>输出:</strong>\n[null, 1, 2, 3, 3]\n\n<strong>解释:</strong>\nRecentCounter recentCounter = new RecentCounter();\nrecentCounter.ping(1); // requests = [<strong>1</strong>],范围是 [-2999,1],返回 1\nrecentCounter.ping(100); // requests = [<strong>1</strong>, <strong>100</strong>],范围是 [-2900,100],返回 2\nrecentCounter.ping(3001); // requests = [<strong>1</strong>, <strong>100</strong>, <strong>3001</strong>],范围是 [1,3001],返回 3\nrecentCounter.ping(3002); // requests = [1, <strong>100</strong>, <strong>3001</strong>, <strong>3002</strong>],范围是 [2,3002],返回 3\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= t &lt;= 10<sup>9</sup></code></li>\n\t<li>保证每次对 <code>ping</code> 调用所使用的 <code>t</code> 值都 <strong>严格递增</strong></li>\n\t<li>至多调用 <code>ping</code> 方法 <code>10<sup>4</sup></code> 次</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 933&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/number-of-recent-calls/\">https://leetcode-cn.com/problems/number-of-recent-calls/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 14,
"likes": 15,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.9K\", \"totalSubmission\": \"11.9K\", \"totalAcceptedRaw\": 9874, \"totalSubmissionRaw\": 11862, \"acRate\": \"83.2%\"}",
"stats": "{\"totalAccepted\": \"10K\", \"totalSubmission\": \"12K\", \"totalAcceptedRaw\": 10003, \"totalSubmissionRaw\": 12027, \"acRate\": \"83.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.2K\", \"totalSubmission\": \"11.9K\", \"totalAcceptedRaw\": 10184, \"totalSubmissionRaw\": 11913, \"acRate\": \"85.5%\"}",
"stats": "{\"totalAccepted\": \"10.3K\", \"totalSubmission\": \"12.1K\", \"totalAcceptedRaw\": 10317, \"totalSubmissionRaw\": 12070, \"acRate\": \"85.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"4.1K\", \"totalAcceptedRaw\": 1351, \"totalSubmissionRaw\": 4079, \"acRate\": \"33.1%\"}",
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"4.1K\", \"totalAcceptedRaw\": 1354, \"totalSubmissionRaw\": 4092, \"acRate\": \"33.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5K\", \"totalSubmission\": \"10.6K\", \"totalAcceptedRaw\": 5005, \"totalSubmissionRaw\": 10594, \"acRate\": \"47.2%\"}",
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 5065, \"totalSubmissionRaw\": 10708, \"acRate\": \"47.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.8K\", \"totalSubmission\": \"9K\", \"totalAcceptedRaw\": 6814, \"totalSubmissionRaw\": 8974, \"acRate\": \"75.9%\"}",
"stats": "{\"totalAccepted\": \"6.9K\", \"totalSubmission\": \"9.2K\", \"totalAcceptedRaw\": 6938, \"totalSubmissionRaw\": 9151, \"acRate\": \"75.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.6K\", \"totalSubmission\": \"9.9K\", \"totalAcceptedRaw\": 7644, \"totalSubmissionRaw\": 9856, \"acRate\": \"77.6%\"}",
"stats": "{\"totalAccepted\": \"7.8K\", \"totalSubmission\": \"10K\", \"totalAcceptedRaw\": 7762, \"totalSubmissionRaw\": 10024, \"acRate\": \"77.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"24.5K\", \"totalSubmission\": \"44K\", \"totalAcceptedRaw\": 24495, \"totalSubmissionRaw\": 43978, \"acRate\": \"55.7%\"}",
"stats": "{\"totalAccepted\": \"24.8K\", \"totalSubmission\": \"44.5K\", \"totalAcceptedRaw\": 24787, \"totalSubmissionRaw\": 44514, \"acRate\": \"55.7%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -174,7 +174,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"2.4K\", \"totalSubmission\": \"5.8K\", \"totalAcceptedRaw\": 2429, \"totalSubmissionRaw\": 5801, \"acRate\": \"41.9%\"}",
"stats": "{\"totalAccepted\": \"2.5K\", \"totalSubmission\": \"5.9K\", \"totalAcceptedRaw\": 2470, \"totalSubmissionRaw\": 5905, \"acRate\": \"41.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"13.3K\", \"totalAcceptedRaw\": 7227, \"totalSubmissionRaw\": 13253, \"acRate\": \"54.5%\"}",
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"13.3K\", \"totalAcceptedRaw\": 7250, \"totalSubmissionRaw\": 13287, \"acRate\": \"54.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"465\", \"totalSubmission\": \"1.7K\", \"totalAcceptedRaw\": 465, \"totalSubmissionRaw\": 1711, \"acRate\": \"27.2%\"}",
"stats": "{\"totalAccepted\": \"474\", \"totalSubmission\": \"1.7K\", \"totalAcceptedRaw\": 474, \"totalSubmissionRaw\": 1732, \"acRate\": \"27.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个单链表 <code>L</code><em> </em>的头节点 <code>head</code> ,单链表 <code>L</code> 表示为:</p>\n\n<p><code>&nbsp;L<sub>0&nbsp;</sub>&rarr; L<sub>1&nbsp;</sub>&rarr; &hellip; &rarr; L<sub>n-1&nbsp;</sub>&rarr; L<sub>n&nbsp;</sub></code><br />\n请将其重新排列后变为</p>\n\n<p><code>L<sub>0&nbsp;</sub>&rarr;&nbsp;L<sub>n&nbsp;</sub>&rarr;&nbsp;L<sub>1&nbsp;</sub>&rarr;&nbsp;L<sub>n-1&nbsp;</sub>&rarr;&nbsp;L<sub>2&nbsp;</sub>&rarr;&nbsp;L<sub>n-2&nbsp;</sub>&rarr; &hellip;</code></p>\n\n<p>不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1626420311-PkUiGI-image.png\" style=\"width: 240px; \" /></p>\n\n<pre>\n<strong>输入: </strong>head = [1,2,3,4]\n<strong>输出: </strong>[1,4,2,3]</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://pic.leetcode-cn.com/1626420320-YUiulT-image.png\" style=\"width: 320px; \" /></p>\n\n<pre>\n<strong>输入: </strong>head = [1,2,3,4,5]\n<strong>输出: </strong>[1,5,2,4,3]</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>链表的长度范围为 <code>[1, 5 * 10<sup>4</sup>]</code></li>\n\t<li><code>1 &lt;= node.val &lt;= 1000</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 143&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/reorder-list/\">https://leetcode-cn.com/problems/reorder-list/</a>&nbsp;</p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 45,
"likes": 46,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"14.9K\", \"totalSubmission\": \"22.5K\", \"totalAcceptedRaw\": 14917, \"totalSubmissionRaw\": 22519, \"acRate\": \"66.2%\"}",
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"22.9K\", \"totalAcceptedRaw\": 15114, \"totalSubmissionRaw\": 22871, \"acRate\": \"66.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.9K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 10860, \"totalSubmissionRaw\": 13520, \"acRate\": \"80.3%\"}",
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 11006, \"totalSubmissionRaw\": 13694, \"acRate\": \"80.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定两个字符串 <code>s</code> 和&nbsp;<code>t</code> 。返回 <code>s</code> 中包含&nbsp;<code>t</code>&nbsp;的所有字符的最短子字符串。如果 <code>s</code> 中不存在符合条件的子字符串,则返回空字符串 <code>&quot;&quot;</code> 。</p>\n\n<p>如果 <code>s</code> 中存在多个符合条件的子字符串,返回任意一个。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>注意: </strong>对于 <code>t</code> 中重复字符,我们寻找的子字符串中该字符数量必须不少于 <code>t</code> 中该字符数量。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = &quot;ADOBECODEBANC&quot;, t = &quot;ABC&quot;\n<strong>输出:</strong>&quot;BANC&quot; \n<strong>解释:</strong>最短子字符串 &quot;BANC&quot; 包含了字符串 t 的所有字符 &#39;A&#39;、&#39;B&#39;、&#39;C&#39;</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = &quot;a&quot;, t = &quot;a&quot;\n<strong>输出:</strong>&quot;a&quot;\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>s = &quot;a&quot;, t = &quot;aa&quot;\n<strong>输出:</strong>&quot;&quot;\n<strong>解释:</strong>t 中两个字符 &#39;a&#39; 均应包含在 s 的子串中,因此没有符合条件的子字符串,返回空字符串。</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= s.length, t.length &lt;= 10<sup>5</sup></code></li>\n\t<li><code>s</code> 和 <code>t</code> 由英文字母组成</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>进阶:</strong>你能设计一个在 <code>o(n)</code> 时间内解决此问题的算法吗?</p>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 76&nbsp;题相似(本题答案不唯一):<a href=\"https://leetcode-cn.com/problems/minimum-window-substring/\">https://leetcode-cn.com/problems/minimum-window-substring/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 31,
"likes": 33,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.8K\", \"totalSubmission\": \"21.5K\", \"totalAcceptedRaw\": 10791, \"totalSubmissionRaw\": 21511, \"acRate\": \"50.2%\"}",
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"21.9K\", \"totalAcceptedRaw\": 10963, \"totalSubmissionRaw\": 21858, \"acRate\": \"50.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -144,7 +144,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7K\", \"totalSubmission\": \"9.4K\", \"totalAcceptedRaw\": 7032, \"totalSubmissionRaw\": 9446, \"acRate\": \"74.4%\"}",
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"9.6K\", \"totalAcceptedRaw\": 7161, \"totalSubmissionRaw\": 9598, \"acRate\": \"74.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"15.4K\", \"totalSubmission\": \"30K\", \"totalAcceptedRaw\": 15379, \"totalSubmissionRaw\": 29989, \"acRate\": \"51.3%\"}",
"stats": "{\"totalAccepted\": \"15.6K\", \"totalSubmission\": \"30.5K\", \"totalAcceptedRaw\": 15609, \"totalSubmissionRaw\": 30457, \"acRate\": \"51.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"20.7K\", \"totalAcceptedRaw\": 10377, \"totalSubmissionRaw\": 20665, \"acRate\": \"50.2%\"}",
"stats": "{\"totalAccepted\": \"10.5K\", \"totalSubmission\": \"20.9K\", \"totalAcceptedRaw\": 10507, \"totalSubmissionRaw\": 20887, \"acRate\": \"50.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.9K\", \"totalSubmission\": \"15.8K\", \"totalAcceptedRaw\": 7867, \"totalSubmissionRaw\": 15778, \"acRate\": \"49.9%\"}",
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"16K\", \"totalAcceptedRaw\": 7969, \"totalSubmissionRaw\": 15955, \"acRate\": \"49.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"11.3K\", \"totalSubmission\": \"15.2K\", \"totalAcceptedRaw\": 11328, \"totalSubmissionRaw\": 15160, \"acRate\": \"74.7%\"}",
"stats": "{\"totalAccepted\": \"11.5K\", \"totalSubmission\": \"15.4K\", \"totalAcceptedRaw\": 11489, \"totalSubmissionRaw\": 15354, \"acRate\": \"74.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.7K\", \"totalSubmission\": \"12.2K\", \"totalAcceptedRaw\": 7657, \"totalSubmissionRaw\": 12217, \"acRate\": \"62.7%\"}",
"stats": "{\"totalAccepted\": \"7.8K\", \"totalSubmission\": \"12.4K\", \"totalAcceptedRaw\": 7768, \"totalSubmissionRaw\": 12419, \"acRate\": \"62.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"12.4K\", \"totalSubmission\": \"18.7K\", \"totalAcceptedRaw\": 12374, \"totalSubmissionRaw\": 18674, \"acRate\": \"66.3%\"}",
"stats": "{\"totalAccepted\": \"12.5K\", \"totalSubmission\": \"18.9K\", \"totalAcceptedRaw\": 12520, \"totalSubmissionRaw\": 18896, \"acRate\": \"66.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<div class=\"title__3Vvk\">\n<p>运用所掌握的数据结构,设计和实现一个&nbsp; <a href=\"https://baike.baidu.com/item/LRU\" target=\"_blank\">LRU (Least Recently Used最近最少使用) 缓存机制</a> 。</p>\n\n<p>实现 <code>LRUCache</code> 类:</p>\n\n<ul>\n\t<li><code>LRUCache(int capacity)</code> 以正整数作为容量&nbsp;<code>capacity</code> 初始化 LRU 缓存</li>\n\t<li><code>int get(int key)</code> 如果关键字 <code>key</code> 存在于缓存中,则返回关键字的值,否则返回 <code>-1</code> 。</li>\n\t<li><code>void put(int key, int value)</code>&nbsp;如果关键字已经存在,则变更其数据值;如果关键字不存在,则插入该组「关键字-值」。当缓存容量达到上限时,它应该在写入新数据之前删除最久未使用的数据值,从而为新的数据值留出空间。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\n[&quot;LRUCache&quot;, &quot;put&quot;, &quot;put&quot;, &quot;get&quot;, &quot;put&quot;, &quot;get&quot;, &quot;put&quot;, &quot;get&quot;, &quot;get&quot;, &quot;get&quot;]\n[[2], [1, 1], [2, 2], [1], [3, 3], [2], [4, 4], [1], [3], [4]]\n<strong>输出</strong>\n[null, null, null, 1, null, -1, null, -1, 3, 4]\n\n<strong>解释</strong>\nLRUCache lRUCache = new LRUCache(2);\nlRUCache.put(1, 1); // 缓存是 {1=1}\nlRUCache.put(2, 2); // 缓存是 {1=1, 2=2}\nlRUCache.get(1); // 返回 1\nlRUCache.put(3, 3); // 该操作会使得关键字 2 作废,缓存是 {1=1, 3=3}\nlRUCache.get(2); // 返回 -1 (未找到)\nlRUCache.put(4, 4); // 该操作会使得关键字 1 作废,缓存是 {4=4, 3=3}\nlRUCache.get(1); // 返回 -1 (未找到)\nlRUCache.get(3); // 返回 3\nlRUCache.get(4); // 返回 4\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= capacity &lt;= 3000</code></li>\n\t<li><code>0 &lt;= key &lt;= 10000</code></li>\n\t<li><code>0 &lt;= value &lt;= 10<sup>5</sup></code></li>\n\t<li>最多调用 <code>2 * 10<sup>5</sup></code> 次 <code>get</code> 和 <code>put</code></li>\n</ul>\n</div>\n\n<p>&nbsp;</p>\n\n<p><strong>进阶</strong>:是否可以在&nbsp;<code>O(1)</code> 时间复杂度内完成这两种操作?</p>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 146&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/lru-cache/\">https://leetcode-cn.com/problems/lru-cache/</a>&nbsp;</p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 39,
"likes": 40,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.4K\", \"totalSubmission\": \"17.5K\", \"totalAcceptedRaw\": 9450, \"totalSubmissionRaw\": 17531, \"acRate\": \"53.9%\"}",
"stats": "{\"totalAccepted\": \"9.5K\", \"totalSubmission\": \"17.7K\", \"totalAcceptedRaw\": 9545, \"totalSubmissionRaw\": 17740, \"acRate\": \"53.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -144,7 +144,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"11.3K\", \"totalSubmission\": \"17.8K\", \"totalAcceptedRaw\": 11272, \"totalSubmissionRaw\": 17815, \"acRate\": \"63.3%\"}",
"stats": "{\"totalAccepted\": \"11.4K\", \"totalSubmission\": \"18K\", \"totalAcceptedRaw\": 11398, \"totalSubmissionRaw\": 18030, \"acRate\": \"63.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个由&nbsp;<code>0</code> 和 <code>1</code>&nbsp;组成的矩阵 <code>matrix</code>&nbsp;,找出只包含 <code>1</code> 的最大矩形,并返回其面积。</p>\n\n<p><strong>注意:</strong>此题 <code>matrix</code>&nbsp;输入格式为一维 <code>01</code> 字符串数组。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/09/14/maximal.jpg\" style=\"width: 402px; height: 322px;\" /></p>\n\n<pre>\n<strong>输入:</strong>matrix = [\"10100\",\"10111\",\"11111\",\"10010\"]\n<strong>输出:</strong>6\n<strong>解释:</strong>最大矩形如上图所示。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>matrix = []\n<strong>输出:</strong>0\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>matrix = [\"0\"]\n<strong>输出:</strong>0\n</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre>\n<strong>输入:</strong>matrix = [\"1\"]\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 5</strong></p>\n\n<pre>\n<strong>输入:</strong>matrix = [\"00\"]\n<strong>输出:</strong>0\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>rows == matrix.length</code></li>\n\t<li><code>cols == matrix[0].length</code></li>\n\t<li><code>0 &lt;= row, cols &lt;= 200</code></li>\n\t<li><code>matrix[i][j]</code> 为 <code>'0'</code> 或 <code>'1'</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p>注意:本题与主站 85 题相同(输入参数格式不同):&nbsp;<a href=\"https://leetcode-cn.com/problems/maximal-rectangle/\">https://leetcode-cn.com/problems/maximal-rectangle/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Hard",
"likes": 28,
"likes": 30,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.9K\", \"totalSubmission\": \"10.2K\", \"totalAcceptedRaw\": 5912, \"totalSubmissionRaw\": 10193, \"acRate\": \"58.0%\"}",
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 5990, \"totalSubmissionRaw\": 10352, \"acRate\": \"57.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.9K\", \"totalSubmission\": \"12K\", \"totalAcceptedRaw\": 5893, \"totalSubmissionRaw\": 12002, \"acRate\": \"49.1%\"}",
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"12.2K\", \"totalAcceptedRaw\": 5985, \"totalSubmissionRaw\": 12169, \"acRate\": \"49.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 6039, \"totalSubmissionRaw\": 10307, \"acRate\": \"58.6%\"}",
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 6115, \"totalSubmissionRaw\": 10440, \"acRate\": \"58.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"4.3K\", \"totalSubmission\": \"7.4K\", \"totalAcceptedRaw\": 4287, \"totalSubmissionRaw\": 7432, \"acRate\": \"57.7%\"}",
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"7.6K\", \"totalAcceptedRaw\": 4388, \"totalSubmissionRaw\": 7620, \"acRate\": \"57.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p><strong><a href=\"https://baike.baidu.com/item/字典树/9825209?fr=aladdin\" target=\"_blank\">Trie</a></strong>(发音类似 &quot;try&quot;)或者说 <strong>前缀树</strong> 是一种树形数据结构,用于高效地存储和检索字符串数据集中的键。这一数据结构有相当多的应用情景,例如自动补完和拼写检查。</p>\n\n<p>请你实现 Trie 类:</p>\n\n<ul>\n\t<li><code>Trie()</code> 初始化前缀树对象。</li>\n\t<li><code>void insert(String word)</code> 向前缀树中插入字符串 <code>word</code> 。</li>\n\t<li><code>boolean search(String word)</code> 如果字符串 <code>word</code> 在前缀树中,返回 <code>true</code>(即,在检索之前已经插入);否则,返回 <code>false</code> 。</li>\n\t<li><code>boolean startsWith(String prefix)</code> 如果之前已经插入的字符串&nbsp;<code>word</code> 的前缀之一为 <code>prefix</code> ,返回 <code>true</code> ;否则,返回 <code>false</code> 。</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\ninputs = [&quot;Trie&quot;, &quot;insert&quot;, &quot;search&quot;, &quot;search&quot;, &quot;startsWith&quot;, &quot;insert&quot;, &quot;search&quot;]\ninputs = [[], [&quot;apple&quot;], [&quot;apple&quot;], [&quot;app&quot;], [&quot;app&quot;], [&quot;app&quot;], [&quot;app&quot;]]\n<strong>输出</strong>\n[null, null, true, false, true, null, true]\n\n<strong>解释</strong>\nTrie trie = new Trie();\ntrie.insert(&quot;apple&quot;);\ntrie.search(&quot;apple&quot;); // 返回 True\ntrie.search(&quot;app&quot;); // 返回 False\ntrie.startsWith(&quot;app&quot;); // 返回 True\ntrie.insert(&quot;app&quot;);\ntrie.search(&quot;app&quot;); // 返回 True\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= word.length, prefix.length &lt;= 2000</code></li>\n\t<li><code>word</code> 和 <code>prefix</code> 仅由小写英文字母组成</li>\n\t<li><code>insert</code>、<code>search</code> 和 <code>startsWith</code> 调用次数 <strong>总计</strong> 不超过 <code>3 * 10<sup>4</sup></code> 次</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 208 题相同:<a href=\"https://leetcode-cn.com/problems/implement-trie-prefix-tree/\">https://leetcode-cn.com/problems/implement-trie-prefix-tree/</a>&nbsp;</p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 11,
"likes": 12,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"7.3K\", \"totalSubmission\": \"9.5K\", \"totalAcceptedRaw\": 7304, \"totalSubmissionRaw\": 9501, \"acRate\": \"76.9%\"}",
"stats": "{\"totalAccepted\": \"7.4K\", \"totalSubmission\": \"9.6K\", \"totalAcceptedRaw\": 7418, \"totalSubmissionRaw\": 9639, \"acRate\": \"77.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"19.3K\", \"totalSubmission\": \"43.9K\", \"totalAcceptedRaw\": 19317, \"totalSubmissionRaw\": 43872, \"acRate\": \"44.0%\"}",
"stats": "{\"totalAccepted\": \"19.5K\", \"totalSubmission\": \"44.4K\", \"totalAcceptedRaw\": 19538, \"totalSubmissionRaw\": 44359, \"acRate\": \"44.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>多级双向链表中,除了指向下一个节点和前一个节点指针之外,它还有一个子链表指针,可能指向单独的双向链表。这些子列表也可能会有一个或多个自己的子项,依此类推,生成多级数据结构,如下面的示例所示。</p>\n\n<p>给定位于列表第一级的头节点,请扁平化列表,即将这样的多级双向链表展平成普通的双向链表,使所有结点出现在单级双链表中。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>head = [1,2,3,4,5,6,null,null,null,7,8,9,10,null,null,11,12]\n<strong>输出:</strong>[1,2,3,7,8,11,12,9,10,4,5,6]\n<strong>解释:\n</strong>\n输入的多级列表如下图所示\n\n<img src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/12/multilevellinkedlist.png\" style=\"height: 363px; width: 640px;\" />\n\n扁平化后的链表如下图\n\n<img src=\"https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/12/multilevellinkedlistflattened.png\" style=\"height: 80px; width: 1100px;\" />\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>head = [1,2,null,3]\n<strong>输出:</strong>[1,3,2]\n<strong>解释:\n\n</strong>输入的多级列表如下图所示:\n\n 1---2---NULL\n |\n 3---NULL\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>head = []\n<strong>输出:</strong>[]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>如何表示测试用例中的多级链表?</strong></p>\n\n<p>以 <strong>示例 1</strong> 为例:</p>\n\n<pre>\n 1---2---3---4---5---6--NULL\n |\n 7---8---9---10--NULL\n |\n 11--12--NULL</pre>\n\n<p>序列化其中的每一级之后:</p>\n\n<pre>\n[1,2,3,4,5,6,null]\n[7,8,9,10,null]\n[11,12,null]\n</pre>\n\n<p>为了将每一级都序列化到一起,我们需要每一级中添加值为 null 的元素,以表示没有节点连接到上一级的上级节点。</p>\n\n<pre>\n[1,2,3,4,5,6,null]\n[null,null,7,8,9,10,null]\n[null,11,12,null]\n</pre>\n\n<p>合并所有序列化结果,并去除末尾的 null 。</p>\n\n<pre>\n[1,2,3,4,5,6,null,null,null,7,8,9,10,null,null,11,12]</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>节点数目不超过 <code>1000</code></li>\n\t<li><code>1 &lt;= Node.val &lt;= 10^5</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 430&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/flatten-a-multilevel-doubly-linked-list/\">https://leetcode-cn.com/problems/flatten-a-multilevel-doubly-linked-list/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 25,
"likes": 26,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -126,7 +126,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"14.9K\", \"totalAcceptedRaw\": 9106, \"totalSubmissionRaw\": 14915, \"acRate\": \"61.1%\"}",
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 9227, \"totalSubmissionRaw\": 15100, \"acRate\": \"61.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"14.2K\", \"totalSubmission\": \"31K\", \"totalAcceptedRaw\": 14231, \"totalSubmissionRaw\": 31045, \"acRate\": \"45.8%\"}",
"stats": "{\"totalAccepted\": \"14.4K\", \"totalSubmission\": \"31.5K\", \"totalAcceptedRaw\": 14430, \"totalSubmissionRaw\": 31471, \"acRate\": \"45.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"18.7K\", \"totalSubmission\": \"35.5K\", \"totalAcceptedRaw\": 18665, \"totalSubmissionRaw\": 35509, \"acRate\": \"52.6%\"}",
"stats": "{\"totalAccepted\": \"18.9K\", \"totalSubmission\": \"35.9K\", \"totalAcceptedRaw\": 18885, \"totalSubmissionRaw\": 35940, \"acRate\": \"52.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -125,7 +125,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.6K\", \"totalSubmission\": \"32.8K\", \"totalAcceptedRaw\": 6618, \"totalSubmissionRaw\": 32810, \"acRate\": \"20.2%\"}",
"stats": "{\"totalAccepted\": \"6.6K\", \"totalSubmission\": \"32.9K\", \"totalAcceptedRaw\": 6647, \"totalSubmissionRaw\": 32895, \"acRate\": \"20.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.6K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 8645, \"totalSubmissionRaw\": 15080, \"acRate\": \"57.3%\"}",
"stats": "{\"totalAccepted\": \"8.8K\", \"totalSubmission\": \"15.3K\", \"totalAcceptedRaw\": 8750, \"totalSubmissionRaw\": 15267, \"acRate\": \"57.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.2K\", \"totalSubmission\": \"12K\", \"totalAcceptedRaw\": 10244, \"totalSubmissionRaw\": 11977, \"acRate\": \"85.5%\"}",
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"12.1K\", \"totalAcceptedRaw\": 10378, \"totalSubmissionRaw\": 12130, \"acRate\": \"85.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定单链表的头节点 <code>head</code> ,请反转链表,并返回反转后的链表的头节点。</p>\n\n<div class=\"original__bRMd\">\n<div>\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/02/19/rev1ex1.jpg\" style=\"width: 302px; \" />\n<pre>\n<strong>输入:</strong>head = [1,2,3,4,5]\n<strong>输出:</strong>[5,4,3,2,1]\n</pre>\n\n<p><strong>示例 2</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/02/19/rev1ex2.jpg\" style=\"width: 102px;\" />\n<pre>\n<strong>输入:</strong>head = [1,2]\n<strong>输出:</strong>[2,1]\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>head = []\n<strong>输出:</strong>[]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>链表中节点的数目范围是 <code>[0, 5000]</code></li>\n\t<li><code>-5000 &lt;= Node.val &lt;= 5000</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>进阶:</strong>链表可以选用迭代或递归方式完成反转。你能否用两种方法解决这道题?</p>\n</div>\n</div>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 206&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/reverse-linked-list/\">https://leetcode-cn.com/problems/reverse-linked-list/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 53,
"likes": 54,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"37.8K\", \"totalSubmission\": \"50.2K\", \"totalAcceptedRaw\": 37805, \"totalSubmissionRaw\": 50228, \"acRate\": \"75.3%\"}",
"stats": "{\"totalAccepted\": \"38.2K\", \"totalSubmission\": \"50.7K\", \"totalAcceptedRaw\": 38195, \"totalSubmissionRaw\": 50749, \"acRate\": \"75.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"8.3K\", \"totalAcceptedRaw\": 5102, \"totalSubmissionRaw\": 8309, \"acRate\": \"61.4%\"}",
"stats": "{\"totalAccepted\": \"5.2K\", \"totalSubmission\": \"8.4K\", \"totalAcceptedRaw\": 5168, \"totalSubmissionRaw\": 8408, \"acRate\": \"61.5%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"3.9K\", \"totalAcceptedRaw\": 1376, \"totalSubmissionRaw\": 3914, \"acRate\": \"35.2%\"}",
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"3.9K\", \"totalAcceptedRaw\": 1377, \"totalSubmissionRaw\": 3915, \"acRate\": \"35.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"8.6K\", \"totalAcceptedRaw\": 6143, \"totalSubmissionRaw\": 8551, \"acRate\": \"71.8%\"}",
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"8.7K\", \"totalAcceptedRaw\": 6233, \"totalSubmissionRaw\": 8671, \"acRate\": \"71.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"20.5K\", \"totalSubmission\": \"39.5K\", \"totalAcceptedRaw\": 20455, \"totalSubmissionRaw\": 39501, \"acRate\": \"51.8%\"}",
"stats": "{\"totalAccepted\": \"20.5K\", \"totalSubmission\": \"39.5K\", \"totalAcceptedRaw\": 20458, \"totalSubmissionRaw\": 39505, \"acRate\": \"51.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1098, \"totalSubmissionRaw\": 3583, \"acRate\": \"30.6%\"}",
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1104, \"totalSubmissionRaw\": 3593, \"acRate\": \"30.7%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定两个字符串&nbsp;<code>s</code>&nbsp;和<b>&nbsp;</b><code>p</code>,找到&nbsp;<code>s</code><strong>&nbsp;</strong>中所有 <code>p</code> 的&nbsp;<strong>变位词&nbsp;</strong>的子串,返回这些子串的起始索引。不考虑答案输出的顺序。</p>\n\n<p><strong>变位词 </strong>指字母相同,但排列不同的字符串。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例&nbsp;1:</strong></p>\n\n<pre>\n<strong>输入: </strong>s = &quot;cbaebabacd&quot;, p = &quot;abc&quot;\n<strong>输出: </strong>[0,6]\n<strong>解释:</strong>\n起始索引等于 0 的子串是 &quot;cba&quot;, 它是 &quot;abc&quot; 的变位词。\n起始索引等于 6 的子串是 &quot;bac&quot;, 它是 &quot;abc&quot; 的变位词。\n</pre>\n\n<p><strong>&nbsp;示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>s = &quot;abab&quot;, p = &quot;ab&quot;\n<strong>输出: </strong>[0,1,2]\n<strong>解释:</strong>\n起始索引等于 0 的子串是 &quot;ab&quot;, 它是 &quot;ab&quot; 的变位词。\n起始索引等于 1 的子串是 &quot;ba&quot;, 它是 &quot;ab&quot; 的变位词。\n起始索引等于 2 的子串是 &quot;ab&quot;, 它是 &quot;ab&quot; 的变位词。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= s.length, p.length &lt;= 3 * 10<sup>4</sup></code></li>\n\t<li><code>s</code>&nbsp;和 <code>p</code> 仅包含小写字母</li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p>注意:本题与主站 438&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/\" style=\"background-color: rgb(255, 255, 255);\">https://leetcode-cn.com/problems/find-all-anagrams-in-a-string/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 15,
"likes": 16,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"12.1K\", \"totalSubmission\": \"19.4K\", \"totalAcceptedRaw\": 12099, \"totalSubmissionRaw\": 19419, \"acRate\": \"62.3%\"}",
"stats": "{\"totalAccepted\": \"12.3K\", \"totalSubmission\": \"19.7K\", \"totalAcceptedRaw\": 12280, \"totalSubmissionRaw\": 19708, \"acRate\": \"62.3%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10K\", \"totalSubmission\": \"11.6K\", \"totalAcceptedRaw\": 9999, \"totalSubmissionRaw\": 11635, \"acRate\": \"85.9%\"}",
"stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"11.8K\", \"totalAcceptedRaw\": 10129, \"totalSubmissionRaw\": 11783, \"acRate\": \"86.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个整数数组&nbsp;<code>nums</code> ,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次 。</strong>请你找出并返回那个只出现了一次的元素。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,2,3,2]\n<strong>输出:</strong>3\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,1,0,1,0,1,100]\n<strong>输出:</strong>100\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= nums.length &lt;= 3 * 10<sup>4</sup></code></li>\n\t<li><code>-2<sup>31</sup> &lt;= nums[i] &lt;= 2<sup>31</sup> - 1</code></li>\n\t<li><code>nums</code> 中,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次</strong></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><strong>进阶:</strong>你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?</p>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 137&nbsp;题相同:<a href=\"https://leetcode-cn.com/problems/single-number-ii/\">https://leetcode-cn.com/problems/single-number-ii/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 55,
"likes": 57,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"26.3K\", \"totalSubmission\": \"37.2K\", \"totalAcceptedRaw\": 26347, \"totalSubmissionRaw\": 37187, \"acRate\": \"70.9%\"}",
"stats": "{\"totalAccepted\": \"26.7K\", \"totalSubmission\": \"37.6K\", \"totalAcceptedRaw\": 26678, \"totalSubmissionRaw\": 37650, \"acRate\": \"70.9%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.8K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 9803, \"totalSubmissionRaw\": 13680, \"acRate\": \"71.7%\"}",
"stats": "{\"totalAccepted\": \"9.9K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 9929, \"totalSubmissionRaw\": 13856, \"acRate\": \"71.7%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"17.6K\", \"totalAcceptedRaw\": 8671, \"totalSubmissionRaw\": 17630, \"acRate\": \"49.2%\"}",
"stats": "{\"totalAccepted\": \"8.8K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 8819, \"totalSubmissionRaw\": 17926, \"acRate\": \"49.2%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -162,7 +162,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"8K\", \"totalAcceptedRaw\": 5262, \"totalSubmissionRaw\": 7966, \"acRate\": \"66.1%\"}",
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"8K\", \"totalAcceptedRaw\": 5276, \"totalSubmissionRaw\": 7987, \"acRate\": \"66.1%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -12,7 +12,7 @@
"translatedContent": "<p>给定一个整数数组 <code>asteroids</code>,表示在同一行的小行星。</p>\n\n<p>对于数组中的每一个元素,其绝对值表示小行星的大小,正负表示小行星的移动方向(正表示向右移动,负表示向左移动)。每一颗小行星以相同的速度移动。</p>\n\n<p>找出碰撞后剩下的所有小行星。碰撞规则:两个行星相互碰撞,较小的行星会爆炸。如果两颗行星大小相同,则两颗行星都会爆炸。两颗移动方向相同的行星,永远不会发生碰撞。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>asteroids = [5,10,-5]\n<strong>输出:</strong>[5,10]\n<b>解释:</b>10 和 -5 碰撞后只剩下 10 。 5 和 10 永远不会发生碰撞。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>asteroids = [8,-8]\n<strong>输出:</strong>[]\n<b>解释:</b>8 和 -8 碰撞后,两者都发生爆炸。</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre>\n<strong>输入:</strong>asteroids = [10,2,-5]\n<strong>输出:</strong>[10]\n<b>解释:</b>2 和 -5 发生碰撞后剩下 -5 。10 和 -5 发生碰撞后剩下 10 。</pre>\n\n<p><strong>示例 4</strong></p>\n\n<pre>\n<strong>输入:</strong>asteroids = [-2,-1,1,2]\n<strong>输出:</strong>[-2,-1,1,2]\n<b>解释</b><strong></strong>-2 和 -1 向左移动,而 1 和 2 向右移动。 由于移动方向相同的行星不会发生碰撞,所以最终没有行星发生碰撞。 </pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 &lt;= asteroids.length&nbsp;&lt;= 10<sup>4</sup></code></li>\n\t<li><code>-1000 &lt;= asteroids[i] &lt;= 1000</code></li>\n\t<li><code>asteroids[i] != 0</code></li>\n</ul>\n\n<p>&nbsp;</p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 735&nbsp;题相同:&nbsp;<a href=\"https://leetcode-cn.com/problems/asteroid-collision/\">https://leetcode-cn.com/problems/asteroid-collision/</a></p>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 20,
"likes": 21,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"10.7K\", \"totalSubmission\": \"24K\", \"totalAcceptedRaw\": 10661, \"totalSubmissionRaw\": 23992, \"acRate\": \"44.4%\"}",
"stats": "{\"totalAccepted\": \"10.8K\", \"totalSubmission\": \"24.3K\", \"totalAcceptedRaw\": 10809, \"totalSubmissionRaw\": 24341, \"acRate\": \"44.4%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"16.1K\", \"totalSubmission\": \"31.2K\", \"totalAcceptedRaw\": 16096, \"totalSubmissionRaw\": 31168, \"acRate\": \"51.6%\"}",
"stats": "{\"totalAccepted\": \"16.3K\", \"totalSubmission\": \"31.6K\", \"totalAcceptedRaw\": 16283, \"totalSubmissionRaw\": 31579, \"acRate\": \"51.6%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"551\", \"totalSubmission\": \"1.2K\", \"totalAcceptedRaw\": 551, \"totalSubmissionRaw\": 1208, \"acRate\": \"45.6%\"}",
"stats": "{\"totalAccepted\": \"556\", \"totalSubmission\": \"1.2K\", \"totalAcceptedRaw\": 556, \"totalSubmissionRaw\": 1213, \"acRate\": \"45.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -156,7 +156,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"10.5K\", \"totalAcceptedRaw\": 6097, \"totalSubmissionRaw\": 10533, \"acRate\": \"57.9%\"}",
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 6181, \"totalSubmissionRaw\": 10654, \"acRate\": \"58.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"2.4K\", \"totalSubmission\": \"5.8K\", \"totalAcceptedRaw\": 2383, \"totalSubmissionRaw\": 5827, \"acRate\": \"40.9%\"}",
"stats": "{\"totalAccepted\": \"2.4K\", \"totalSubmission\": \"5.8K\", \"totalAcceptedRaw\": 2390, \"totalSubmissionRaw\": 5836, \"acRate\": \"41.0%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -150,7 +150,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"11.1K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 11102, \"totalSubmissionRaw\": 13921, \"acRate\": \"79.8%\"}",
"stats": "{\"totalAccepted\": \"11.2K\", \"totalSubmission\": \"14.1K\", \"totalAcceptedRaw\": 11214, \"totalSubmissionRaw\": 14053, \"acRate\": \"79.8%\"}",
"hints": [],
"solution": null,
"status": null,

View File

@ -168,7 +168,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"9.6K\", \"totalSubmission\": \"13.8K\", \"totalAcceptedRaw\": 9598, \"totalSubmissionRaw\": 13772, \"acRate\": \"69.7%\"}",
"stats": "{\"totalAccepted\": \"9.8K\", \"totalSubmission\": \"14K\", \"totalAcceptedRaw\": 9750, \"totalSubmissionRaw\": 13983, \"acRate\": \"69.7%\"}",
"hints": [],
"solution": null,
"status": null,

Some files were not shown because too many files have changed in this diff Show More