mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-04-18 08:39:41 +08:00
update
This commit is contained in:
parent
7ea03594b3
commit
2a71c78585
leetcode-cn/originData
01-matrix.json05ZEDJ.json0H97ZC.json0i0mDW.json0jQkd0.json0on3uN.json0ynMMM.json1-bit-and-2-bit-characters.json132-pattern.json1fGaJU.json1nzheng-shu-zhong-1chu-xian-de-ci-shu-lcof.json2-keys-keyboard.json21dk04.json24-game.json2AoeFn.json2VG8Kg.json2bCMpM.json2vYnGI.json3Etpl5.json3sum-closest.json3sum-with-multiplicity.json3sum.json3u1WK4.json4sjJUc.json4sum-ii.json4sum.json4ueAj6.json4xy4Wx.json569nqc.json5TxKeK.json6UEx57.json6eUYwP.json7LpjUW.json7WHec2.json7WqeDu.json7p8L0Z.json7rLGCR.json8Zf90G.jsonA1NYOS.jsonB1IidL.jsonD0F0SV.jsonDFPeFJ.jsonDb3wC1.jsonDe4qBB.jsonFortPu.jsonGu0c2T.jsonGzCJIP.jsonH6lPxb.jsonH8086Q.jsonIDBivT.jsonIQvJ9i.jsonIY6buf.jsonIlPe0q.jsonJEj789.jsonJFETK5.jsonJf1JuT.jsonJu9Xwi.jsonK8GULz.jsonLGjMqU.jsonLwUNpT.jsonM1oyTv.jsonM99OJA.jsonMPnaiL.jsonN6YdxV.jsonNUPfPr.jsonNYBBNL.jsonNaqhDT.jsonO4NDxx.jsonOrIXps.jsonP5rCT8.jsonPLYXKQ.jsonPTXy4P.jsonPzWKhm.jsonQ91FMA.jsonQA2IGt.jsonQC3q1f.jsonQTMn0o.jsonQv1Da2.jsonRQku0D.jsonSLwz0R.jsonSNJvJP.jsonSsGoHC.jsonTVdhkn.jsonUHnkqh.jsonUS1pGT.jsonUh984O.jsonUhWRSj.jsonUlBDOe.jsonUp5XYM.jsonVabMRr.jsonVvJkup.jsonWGki4K.jsonWHnhjV.jsonWNC0Lk.jsonWhsWhI.jsonWqXACV.jsonXagZNi.jsonXltzEq.jsonY1VbOX.jsonYaVDxD.json
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个由 <code>0</code> 和 <code>1</code> 组成的矩阵 <code>mat</code> ,请输出一个大小相同的矩阵,其中每一个格子是 <code>mat</code> 中对应位置元素到最近的 <code>0</code> 的距离。</p>\n\n<p>两个相邻元素间的距离为 <code>1</code> 。</p>\n\n<p> </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> </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 <= m, n <= 10<sup>4</sup></code></li>\n\t<li><code>1 <= m * n <= 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 </code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 643,
|
||||
"likes": 678,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"94.1K\", \"totalSubmission\": \"204.7K\", \"totalAcceptedRaw\": 94106, \"totalSubmissionRaw\": 204670, \"acRate\": \"46.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"98.9K\", \"totalSubmission\": \"214.4K\", \"totalAcceptedRaw\": 98888, \"totalSubmissionRaw\": 214374, \"acRate\": \"46.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "「力扣挑战赛」有 `n` 个比赛场馆(场馆编号从 `0` 开始),场馆之间的通道分布情况记录于二维数组 `edges` 中,`edges[i]= [x, y]` 表示第 `i` 条通道连接场馆 `x` 和场馆 `y`(即两个场馆相邻)。初始每个场馆中都有一定人数的志愿者(不同场馆人数可能不同),后续 `m` 天每天均会根据赛事热度进行志愿者人数调配。调配方案分为如下三种:\n1. 将编号为 `idx` 的场馆内的志愿者人数减半;\n2. 将编号为 `idx` 的场馆相邻的场馆的志愿者人数都加上编号为 `idx` 的场馆的志愿者人数;\n3. 将编号为 `idx` 的场馆相邻的场馆的志愿者人数都减去编号为 `idx` 的场馆的志愿者人数。\n\n所有的调配信息记录于数组 `plans` 中,`plans[i] = [num,idx]` 表示第 `i` 天对编号 `idx` 的场馆执行了第 `num` 种调配方案。\n在比赛结束后对调配方案进行复盘时,不慎将第 `0` 个场馆的**最终**志愿者人数丢失,只保留了**初始**所有场馆的志愿者总人数 `totalNum` ,以及记录了第 `1 ~ n-1` 个场馆的**最终**志愿者人数的一维数组 `finalCnt`。请你根据现有的信息求出初始每个场馆的志愿者人数,并按场馆编号顺序返回志愿者人数列表。\n\n**注意:**\n- 测试数据保证当某场馆进行第一种调配时,该场馆的志愿者人数一定为偶数;\n- 测试数据保证当某场馆进行第三种调配时,该场馆的相邻场馆志愿者人数不为负数;\n- 测试数据保证比赛开始时每个场馆的志愿者人数都不超过 `10^9`;\n- 测试数据保证给定的场馆间的道路分布情况中不会出现自环、重边的情况。\n\n\n**示例 1:**\n>\n> 输入:\n>`finalCnt = [1,16], totalNum = 21, edges = [[0,1],[1,2]], plans = [[2,1],[1,0],[3,0]]`\n>\n> 输出:`[5,7,9]`\n>\n> 解释:\n> {:height=200}\n\n\n**示例 2 :**\n> 输入:\n>`finalCnt = [4,13,4,3,8], totalNum = 54, edges = [[0,3],[1,3],[4,3],[2,3],[2,5]], plans = [[1,1],[3,3],[2,5],[1,0]]`\n>\n> 输出:`[10,16,9,4,7,8]`\n\n\n\n**提示:**\n- `2 <= n <= 5*10^4`\n- `1 <= edges.length <= min((n * (n - 1)) / 2, 5*10^4)`\n- `0 <= edges[i][0], edges[i][1] < n`\n- `1 <= plans.length <= 10`\n- `1 <= plans[i][0] <=3`\n- `0 <= plans[i][1] < n`\n- `finalCnt.length = n-1`\n- `0 <= finalCnt[i] < 10^9`\n- `0 <= totalNum < 5*10^13`\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 2,
|
||||
"likes": 4,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"2.7K\", \"totalAcceptedRaw\": 1128, \"totalSubmissionRaw\": 2731, \"acRate\": \"41.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"2.9K\", \"totalAcceptedRaw\": 1242, \"totalSubmissionRaw\": 2899, \"acRate\": \"42.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定两个数组,<code>arr1</code> 和 <code>arr2</code>,</p>\n\n<ul>\n\t<li><code>arr2</code> 中的元素各不相同</li>\n\t<li><code>arr2</code> 中的每个元素都出现在 <code>arr1</code> 中</li>\n</ul>\n\n<p>对 <code>arr1</code> 中的元素进行排序,使 <code>arr1</code> 中项的相对顺序和 <code>arr2</code> 中的相对顺序相同。未在 <code>arr2</code> 中出现过的元素需要按照升序放在 <code>arr1</code> 的末尾。</p>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr1 = [2,3,1,3,2,4,6,7,9,2,19], arr2 = [2,1,4,3,9,6]\n<strong>输出:</strong>[2,2,2,1,4,3,3,9,6,7,19]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= arr1.length, arr2.length <= 1000</code></li>\n\t<li><code>0 <= arr1[i], arr2[i] <= 1000</code></li>\n\t<li><code>arr2</code> 中的元素 <code>arr2[i]</code> 各不相同</li>\n\t<li><code>arr2</code> 中的每个元素 <code>arr2[i]</code> 都出现在 <code>arr1</code> 中</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 1122 题相同:<a href=\"https://leetcode-cn.com/problems/relative-sort-array/\">https://leetcode-cn.com/problems/relative-sort-array/</a> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 21,
|
||||
"likes": 24,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.3K\", \"totalSubmission\": \"13.1K\", \"totalAcceptedRaw\": 9262, \"totalSubmissionRaw\": 13114, \"acRate\": \"70.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"15.5K\", \"totalAcceptedRaw\": 10973, \"totalSubmissionRaw\": 15508, \"acRate\": \"70.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个包含非负整数的 <code><em>m</em> x <em>n</em></code> 网格 <code>grid</code> ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。</p>\n\n<p><strong>说明:</strong>一个机器人每次只能向下或者向右移动一步。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/11/05/minpath.jpg\" style=\"width: 242px; height: 242px;\" /></p>\n\n<pre>\n<strong>输入:</strong>grid = [[1,3,1],[1,5,1],[4,2,1]]\n<strong>输出:</strong>7\n<strong>解释:</strong>因为路径 1→3→1→1→1 的总和最小。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>grid = [[1,2,3],[4,5,6]]\n<strong>输出:</strong>12\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == grid.length</code></li>\n\t<li><code>n == grid[i].length</code></li>\n\t<li><code>1 <= m, n <= 200</code></li>\n\t<li><code>0 <= grid[i][j] <= 100</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 64 题相同: <a href=\"https://leetcode-cn.com/problems/minimum-path-sum/\">https://leetcode-cn.com/problems/minimum-path-sum/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 16,
|
||||
"likes": 17,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.3K\", \"totalSubmission\": \"11.5K\", \"totalAcceptedRaw\": 8298, \"totalSubmissionRaw\": 11454, \"acRate\": \"72.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9.8K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 9785, \"totalSubmissionRaw\": 13516, \"acRate\": \"72.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"9.7K\", \"totalAcceptedRaw\": 5108, \"totalSubmissionRaw\": 9716, \"acRate\": \"52.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.4K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 5439, \"totalSubmissionRaw\": 10282, \"acRate\": \"52.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个只包含数字的字符串 <code>s</code> ,用以表示一个 IP 地址,返回所有可能从 <code>s</code> 获得的 <strong>有效 IP 地址 </strong>。你可以按任何顺序返回答案。</p>\n\n<p><strong>有效 IP 地址</strong> 正好由四个整数(每个整数位于 0 到 255 之间组成,且不能含有前导 <code>0</code>),整数之间用 <code>'.'</code> 分隔。</p>\n\n<p>例如:"0.1.2.201" 和 "192.168.1.1" 是 <strong>有效</strong> IP 地址,但是 "0.011.255.245"、"192.168.1.312" 和 "192.168@1.1" 是 <strong>无效</strong> IP 地址。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "25525511135"\n<strong>输出:</strong>["255.255.11.135","255.255.111.35"]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "0000"\n<strong>输出:</strong>["0.0.0.0"]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "1111"\n<strong>输出:</strong>["1.1.1.1"]\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "010010"\n<strong>输出:</strong>["0.10.0.10","0.100.1.0"]\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "10203040"\n<strong>输出:</strong>["10.20.30.40","102.0.30.40","10.203.0.40"]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= s.length <= 3000</code></li>\n\t<li><code>s</code> 仅由数字组成</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 93 题相同:<a href=\"https://leetcode-cn.com/problems/restore-ip-addresses/\">https://leetcode-cn.com/problems/restore-ip-addresses/</a> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 20,
|
||||
"likes": 23,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.5K\", \"totalSubmission\": \"11.9K\", \"totalAcceptedRaw\": 7467, \"totalSubmissionRaw\": 11855, \"acRate\": \"63.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 8710, \"totalSubmissionRaw\": 13857, \"acRate\": \"62.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定非负整数数组 <code>heights</code> ,数组中的数字用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 <code>1</code> 。</p>\n\n<p>求在该柱状图中,能够勾勒出来的矩形的最大面积。</p>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= heights.length <=10<sup>5</sup></code></li>\n\t<li><code>0 <= heights[i] <= 10<sup>4</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 84 题相同: <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": 32,
|
||||
"likes": 38,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"18.1K\", \"totalAcceptedRaw\": 9091, \"totalSubmissionRaw\": 18120, \"acRate\": \"50.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"21.9K\", \"totalAcceptedRaw\": 11020, \"totalSubmissionRaw\": 21881, \"acRate\": \"50.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"61.3K\", \"totalSubmission\": \"110.7K\", \"totalAcceptedRaw\": 61347, \"totalSubmissionRaw\": 110677, \"acRate\": \"55.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"61.9K\", \"totalSubmission\": \"111.7K\", \"totalAcceptedRaw\": 61922, \"totalSubmissionRaw\": 111686, \"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."
|
||||
],
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> ,数组中共有 <code>n</code> 个整数。<strong>132 模式的子序列</strong> 由三个整数 <code>nums[i]</code>、<code>nums[j]</code> 和 <code>nums[k]</code> 组成,并同时满足:<code>i < j < k</code> 和 <code>nums[i] < nums[k] < nums[j]</code> 。</p>\n\n<p>如果 <code>nums</code> 中存在 <strong>132 模式的子序列</strong> ,返回 <code>true</code> ;否则,返回 <code>false</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,4]\n<strong>输出:</strong>false\n<strong>解释:</strong>序列中不存在 132 模式的子序列。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [3,1,4,2]\n<strong>输出:</strong>true\n<strong>解释:</strong>序列中有 1 个 132 模式的子序列: [1, 4, 2] 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [-1,3,2,0]\n<strong>输出:</strong>true\n<strong>解释:</strong>序列中有 3 个 132 模式的的子序列:[-1, 3, 2]、[-1, 3, 0] 和 [-1, 2, 0] 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == nums.length</code></li>\n\t<li><code>1 <= n <= 2 * 10<sup>5</sup></code></li>\n\t<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 637,
|
||||
"likes": 642,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"63.2K\", \"totalSubmission\": \"174.3K\", \"totalAcceptedRaw\": 63155, \"totalSubmissionRaw\": 174266, \"acRate\": \"36.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"64.3K\", \"totalSubmission\": \"177.5K\", \"totalAcceptedRaw\": 64324, \"totalSubmissionRaw\": 177462, \"acRate\": \"36.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个包含 <code>n</code> 个整数的数组 <code>nums</code>,判断 <code>nums</code> 中是否存在三个元素 <code>a</code> ,<code>b</code> ,<code>c</code> <em>,</em>使得 <code>a + b + c = 0</code> ?请找出所有和为 <code>0</code> 且 <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\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 15 题相同:<a href=\"https://leetcode-cn.com/problems/3sum/\">https://leetcode-cn.com/problems/3sum/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 46,
|
||||
"likes": 53,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"21.8K\", \"totalSubmission\": \"49.1K\", \"totalAcceptedRaw\": 21786, \"totalSubmissionRaw\": 49105, \"acRate\": \"44.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"25.2K\", \"totalSubmission\": \"57.1K\", \"totalAcceptedRaw\": 25250, \"totalSubmissionRaw\": 57070, \"acRate\": \"44.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>输入一个整数 <code>n</code> ,求1~n这n个整数的十进制表示中1出现的次数。</p>\n\n<p>例如,输入12,1~12这些整数中包含1 的数字有1、10、11和12,1一共出现了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": 305,
|
||||
"likes": 317,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"62.4K\", \"totalSubmission\": \"125.5K\", \"totalAcceptedRaw\": 62375, \"totalSubmissionRaw\": 125453, \"acRate\": \"49.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"65.3K\", \"totalSubmission\": \"131.1K\", \"totalAcceptedRaw\": 65333, \"totalSubmissionRaw\": 131127, \"acRate\": \"49.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -7,12 +7,12 @@
|
||||
"boundTopicId": 1811,
|
||||
"title": "2 Keys Keyboard",
|
||||
"titleSlug": "2-keys-keyboard",
|
||||
"content": "<p>There is only one character <code>'A'</code> on the screen of a notepad. You can perform two operations on this notepad for each step:</p>\n\n<ul>\n\t<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>\n\t<li>Paste: You can paste the characters which are copied last time.</li>\n</ul>\n\n<p>Given an integer <code>n</code>, return <em>the minimum number of operations to get the character</em> <code>'A'</code> <em>exactly</em> <code>n</code> <em>times on the screen</em>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 3\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> Intitally, we have one character 'A'.\nIn step 1, we use Copy All operation.\nIn step 2, we use Paste operation to get 'AA'.\nIn step 3, we use Paste operation to get 'AAA'.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 1\n<strong>Output:</strong> 0\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 1000</code></li>\n</ul>\n",
|
||||
"content": "<p>There is only one character <code>'A'</code> on the screen of a notepad. You can perform one of two operations on this notepad for each step:</p>\n\n<ul>\n\t<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>\n\t<li>Paste: You can paste the characters which are copied last time.</li>\n</ul>\n\n<p>Given an integer <code>n</code>, return <em>the minimum number of operations to get the character</em> <code>'A'</code> <em>exactly</em> <code>n</code> <em>times on the screen</em>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 3\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> Initially, we have one character 'A'.\nIn step 1, we use Copy All operation.\nIn step 2, we use Paste operation to get 'AA'.\nIn step 3, we use Paste operation to get 'AAA'.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> n = 1\n<strong>Output:</strong> 0\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 1000</code></li>\n</ul>\n",
|
||||
"translatedTitle": "只有两个键的键盘",
|
||||
"translatedContent": "<p>最初记事本上只有一个字符 <code>'A'</code> 。你每次可以对这个记事本进行两种操作:</p>\n\n<ul>\n\t<li><code>Copy All</code>(复制全部):复制这个记事本中的所有字符(不允许仅复制部分字符)。</li>\n\t<li><code>Paste</code>(粘贴):粘贴<strong> 上一次 </strong>复制的字符。</li>\n</ul>\n\n<p>给你一个数字 <code>n</code> ,你需要使用最少的操作次数,在记事本上输出 <strong>恰好</strong> <code>n</code> 个 <code>'A'</code> 。返回能够打印出 <code>n</code> 个 <code>'A'</code> 的最少操作次数。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>3\n<strong>输出:</strong>3\n<strong>解释:</strong>\n最初, 只有一个字符 'A'。\n第 1 步, 使用 <strong>Copy All</strong> 操作。\n第 2 步, 使用 <strong>Paste </strong>操作来获得 'AA'。\n第 3 步, 使用 <strong>Paste</strong> 操作来获得 'AAA'。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 1\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 1000</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 447,
|
||||
"likes": 454,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"4 Keys Keyboard\", \"titleSlug\": \"4-keys-keyboard\", \"difficulty\": \"Medium\", \"translatedTitle\": \"4\\u952e\\u952e\\u76d8\"}, {\"title\": \"Broken Calculator\", \"titleSlug\": \"broken-calculator\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u574f\\u4e86\\u7684\\u8ba1\\u7b97\\u5668\"}]",
|
||||
@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"54.6K\", \"totalSubmission\": \"95.9K\", \"totalAcceptedRaw\": 54596, \"totalSubmissionRaw\": 95857, \"acRate\": \"57.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"55.9K\", \"totalSubmission\": \"98K\", \"totalAcceptedRaw\": 55894, \"totalSubmissionRaw\": 98030, \"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?"
|
||||
],
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个字符串 <code>s</code><strong> </strong>和一个字符串 <code>t</code> ,计算在 <code>s</code> 的子序列中 <code>t</code> 出现的个数。</p>\n\n<p>字符串的一个 <strong>子序列</strong> 是指,通过删除一些(也可以不删除)字符且不干扰剩余字符相对位置所组成的新字符串。(例如,<code>"ACE"</code> 是 <code>"ABCDE"</code> 的一个子序列,而 <code>"AEC"</code> 不是)</p>\n\n<p>题目数据保证答案符合 32 位带符号整数范围。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "rabbbit", t = "rabbit"<code>\n<strong>输出</strong></code><strong>:</strong><code>3\n</code><strong>解释:</strong>\n如下图所示, 有 3 种可以从 s 中得到 <code>"rabbit" 的方案</code>。\n<code><strong><u>rabb</u></strong>b<strong><u>it</u></strong></code>\n<code><strong><u>ra</u></strong>b<strong><u>bbit</u></strong></code>\n<code><strong><u>rab</u></strong>b<strong><u>bit</u></strong></code></pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "babgbag", t = "bag"\n<code><strong>输出</strong></code><strong>:</strong><code>5\n</code><strong>解释:</strong>\n如下图所示, 有 5 种可以从 s 中得到 <code>"bag" 的方案</code>。 \n<code><strong><u>ba</u></strong>b<u><strong>g</strong></u>bag</code>\n<code><strong><u>ba</u></strong>bgba<strong><u>g</u></strong></code>\n<code><u><strong>b</strong></u>abgb<strong><u>ag</u></strong></code>\n<code>ba<u><strong>b</strong></u>gb<u><strong>ag</strong></u></code>\n<code>babg<strong><u>bag</u></strong></code>\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= s.length, t.length <= 1000</code></li>\n\t<li><code>s</code> 和 <code>t</code> 由英文字母组成</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 115 题相同: <a href=\"https://leetcode-cn.com/problems/distinct-subsequences/\">https://leetcode-cn.com/problems/distinct-subsequences/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 14,
|
||||
"likes": 18,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.2K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 4205, \"totalSubmissionRaw\": 7854, \"acRate\": \"53.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"9.4K\", \"totalAcceptedRaw\": 5108, \"totalSubmissionRaw\": 9439, \"acRate\": \"54.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个长度为4的整数数组 <code>cards</code> 。你有 <code>4</code> 张卡片,每张卡片上都包含一个范围在 <code>[1,9]</code> 的数字。您应该使用运算符 <code>['+', '-', '*', '/']</code> 和括号 <code>'('</code> 和 <code>')'</code> 将这些卡片上的数字排列成数学表达式,以获得值24。</p>\n\n<p>你须遵守以下规则:</p>\n\n<ul>\n\t<li>除法运算符 <code>'/'</code> 表示实数除法,而不是整数除法。\n\n\t<ul>\n\t\t<li>例如, <code>4 /(1 - 2 / 3)= 4 /(1 / 3)= 12</code> 。</li>\n\t</ul>\n\t</li>\n\t<li>每个运算都在两个数字之间。特别是,不能使用 <code>“-”</code> 作为一元运算符。\n\t<ul>\n\t\t<li>例如,如果 <code>cards =[1,1,1,1]</code> ,则表达式 <code>“-1 -1 -1 -1”</code> 是 <strong>不允许</strong> 的。</li>\n\t</ul>\n\t</li>\n\t<li>你不能把数字串在一起\n\t<ul>\n\t\t<li>例如,如果 <code>cards =[1,2,1,2]</code> ,则表达式 <code>“12 + 12”</code> 无效。</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>如果可以得到这样的表达式,其计算结果为 <code>24</code> ,则返回 <code>true </code>,否则返回 <code>false</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> cards = [4, 1, 8, 7]\n<strong>输出:</strong> true\n<strong>解释:</strong> (8-4) * (7-1) = 24\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> cards = [1, 2, 1, 2]\n<strong>输出:</strong> false\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>cards.length == 4</code></li>\n\t<li><code>1 <= cards[i] <= 9</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 365,
|
||||
"likes": 368,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"30K\", \"totalSubmission\": \"55.5K\", \"totalAcceptedRaw\": 30034, \"totalSubmissionRaw\": 55545, \"acRate\": \"54.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"31.4K\", \"totalSubmission\": \"58.2K\", \"totalAcceptedRaw\": 31405, \"totalSubmissionRaw\": 58169, \"acRate\": \"54.0%\"}",
|
||||
"hints": [],
|
||||
"solution": {
|
||||
"id": "148",
|
||||
|
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.8K\", \"totalSubmission\": \"8.8K\", \"totalAcceptedRaw\": 6754, \"totalSubmissionRaw\": 8850, \"acRate\": \"76.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"10.5K\", \"totalAcceptedRaw\": 8044, \"totalSubmissionRaw\": 10529, \"acRate\": \"76.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个含有 <code>n</code><strong> </strong>个正整数的数组和一个正整数 <code>target</code><strong> 。</strong></p>\n\n<p>找出该数组中满足其和<strong> </strong><code>≥ target</code><strong> </strong>的长度最小的 <strong>连续子数组</strong> <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> </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>子数组 <code>[4,3]</code> 是该条件下的长度最小的子数组。\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> </p>\n\n<p>提示:</p>\n\n<ul>\n\t<li><code>1 <= target <= 10<sup>9</sup></code></li>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>1 <= nums[i] <= 10<sup>5</sup></code></li>\n</ul>\n\n<p> </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> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 209 题相同:<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": 51,
|
||||
"likes": 61,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"22K\", \"totalSubmission\": \"44.8K\", \"totalAcceptedRaw\": 21996, \"totalSubmissionRaw\": 44778, \"acRate\": \"49.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"25.7K\", \"totalSubmission\": \"52.5K\", \"totalAcceptedRaw\": 25655, \"totalSubmissionRaw\": 52515, \"acRate\": \"48.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个由 <code>0</code> 和 <code>1</code> 组成的矩阵 <code>mat</code> ,请输出一个大小相同的矩阵,其中每一个格子是 <code>mat</code> 中对应位置元素到最近的 <code>0</code> 的距离。</p>\n\n<p>两个相邻元素间的距离为 <code>1</code> 。</p>\n\n<p> </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> </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 <= m, n <= 10<sup>4</sup></code></li>\n\t<li><code>1 <= m * n <= 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 </code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 542 题相同:<a href=\"https://leetcode-cn.com/problems/01-matrix/\">https://leetcode-cn.com/problems/01-matrix/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 19,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.5K\", \"totalSubmission\": \"8.5K\", \"totalAcceptedRaw\": 4506, \"totalSubmissionRaw\": 8529, \"acRate\": \"52.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.5K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 5477, \"totalSubmissionRaw\": 10370, \"acRate\": \"52.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"20K\", \"totalSubmission\": \"68.2K\", \"totalAcceptedRaw\": 20027, \"totalSubmissionRaw\": 68174, \"acRate\": \"29.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"20.6K\", \"totalSubmission\": \"69.7K\", \"totalAcceptedRaw\": 20586, \"totalSubmissionRaw\": 69667, \"acRate\": \"29.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个二叉树的根节点 <code>root</code> ,树中每个节点都存放有一个 <code>0</code> 到 <code>9</code> 之间的数字。</p>\n\n<div class=\"original__bRMd\">\n<div>\n<p>每条从根节点到叶节点的路径都代表一个数字:</p>\n\n<ul>\n\t<li>例如,从根节点到叶节点的路径 <code>1 -> 2 -> 3</code> 表示数字 <code>123</code> 。</li>\n</ul>\n\n<p>计算从根节点到叶节点生成的 <strong>所有数字之和</strong> 。</p>\n\n<p><strong>叶节点</strong> 是指没有子节点的节点。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/02/19/num1tree.jpg\" style=\"width: 212px; height: 182px;\" />\n<pre>\n<strong>输入:</strong>root = [1,2,3]\n<strong>输出:</strong>25\n<strong>解释:</strong>\n从根到叶子节点路径 <code>1->2</code> 代表数字 <code>12</code>\n从根到叶子节点路径 <code>1->3</code> 代表数字 <code>13</code>\n因此,数字总和 = 12 + 13 = <code>25</code></pre>\n\n<p><strong>示例 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2021/02/19/num2tree.jpg\" style=\"width: 292px; height: 302px;\" />\n<pre>\n<strong>输入:</strong>root = [4,9,0,5,1]\n<strong>输出:</strong>1026\n<strong>解释:</strong>\n从根到叶子节点路径 <code>4->9->5</code> 代表数字 495\n从根到叶子节点路径 <code>4->9->1</code> 代表数字 491\n从根到叶子节点路径 <code>4->0</code> 代表数字 40\n因此,数字总和 = 495 + 491 + 40 = <code>1026</code>\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>树中节点的数目在范围 <code>[1, 1000]</code> 内</li>\n\t<li><code>0 <= Node.val <= 9</code></li>\n\t<li>树的深度不超过 <code>10</code></li>\n</ul>\n</div>\n</div>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 129 题相同: <a href=\"https://leetcode-cn.com/problems/sum-root-to-leaf-numbers/\">https://leetcode-cn.com/problems/sum-root-to-leaf-numbers/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 20,
|
||||
"likes": 23,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.6K\", \"totalSubmission\": \"14K\", \"totalAcceptedRaw\": 10589, \"totalSubmissionRaw\": 14027, \"acRate\": \"75.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.6K\", \"totalSubmission\": \"16.8K\", \"totalAcceptedRaw\": 12584, \"totalSubmissionRaw\": 16842, \"acRate\": \"74.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个长度为 <code>n</code> 的整数数组 <code>nums</code><em> </em>和 一个目标值 <code>target</code>。请你从 <code>nums</code><em> </em>中选出三个整数,使它们的和与 <code>target</code> 最接近。</p>\n\n<p>返回这三个数的和。</p>\n\n<p>假定每组输入只存在恰好一个解。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [-1,2,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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= nums.length <= 1000</code></li>\n\t<li><code>-1000 <= nums[i] <= 1000</code></li>\n\t<li><code>-10<sup>4</sup> <= target <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 1088,
|
||||
"likes": 1124,
|
||||
"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\": \"327.9K\", \"totalSubmission\": \"716.9K\", \"totalAcceptedRaw\": 327937, \"totalSubmissionRaw\": 716886, \"acRate\": \"45.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"341.6K\", \"totalSubmission\": \"747.7K\", \"totalAcceptedRaw\": 341649, \"totalSubmissionRaw\": 747728, \"acRate\": \"45.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -7,12 +7,12 @@
|
||||
"boundTopicId": 2054,
|
||||
"title": "3Sum With Multiplicity",
|
||||
"titleSlug": "3sum-with-multiplicity",
|
||||
"content": "<p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i < j < k</code> and <code>arr[i] + arr[j] + arr[k] == target</code>.</p>\n\n<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,3,3,4,4,5,5], target = 8\n<strong>Output:</strong> 20\n<strong>Explanation: </strong>\nEnumerating by the values (arr[i], arr[j], arr[k]):\n(1, 2, 5) occurs 8 times;\n(1, 3, 4) occurs 8 times;\n(2, 2, 4) occurs 2 times;\n(2, 3, 3) occurs 2 times.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,2,2], target = 5\n<strong>Output:</strong> 12\n<strong>Explanation: </strong>\narr[i] = 1, arr[j] = arr[k] = 2 occurs 12 times:\nWe choose one 1 from [1,1] in 2 ways,\nand two 2s from [2,2,2,2] in 6 ways.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 3000</code></li>\n\t<li><code>0 <= arr[i] <= 100</code></li>\n\t<li><code>0 <= target <= 300</code></li>\n</ul>\n",
|
||||
"content": "<p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i < j < k</code> and <code>arr[i] + arr[j] + arr[k] == target</code>.</p>\n\n<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,3,3,4,4,5,5], target = 8\n<strong>Output:</strong> 20\n<strong>Explanation: </strong>\nEnumerating by the values (arr[i], arr[j], arr[k]):\n(1, 2, 5) occurs 8 times;\n(1, 3, 4) occurs 8 times;\n(2, 2, 4) occurs 2 times;\n(2, 3, 3) occurs 2 times.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [1,1,2,2,2,2], target = 5\n<strong>Output:</strong> 12\n<strong>Explanation: </strong>\narr[i] = 1, arr[j] = arr[k] = 2 occurs 12 times:\nWe choose one 1 from [1,1] in 2 ways,\nand two 2s from [2,2,2,2] in 6 ways.\n</pre>\n\n<p><strong>Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> arr = [2,1,3], target = 6\n<strong>Output:</strong> 1\n<strong>Explanation:</strong> (1, 2, 3) occured one time in the array so we return 1.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 3000</code></li>\n\t<li><code>0 <= arr[i] <= 100</code></li>\n\t<li><code>0 <= target <= 300</code></li>\n</ul>\n",
|
||||
"translatedTitle": "三数之和的多种可能",
|
||||
"translatedContent": "<p>给定一个整数数组<meta charset=\"UTF-8\" /> <code>arr</code> ,以及一个整数 <code>target</code> 作为目标值,返回满足 <code>i < j < k</code> 且<meta charset=\"UTF-8\" /> <code>arr[i] + arr[j] + arr[k] == target</code> 的元组 <code>i, j, k</code> 的数量。</p>\n\n<p>由于结果会非常大,请返回 <code>10<sup>9</sup> + 7</code> 的模。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,1,2,2,3,3,4,4,5,5], target = 8\n<strong>输出:</strong>20\n<strong>解释:</strong>\n按值枚举(arr[i], arr[j], arr[k]):\n(1, 2, 5) 出现 8 次;\n(1, 3, 4) 出现 8 次;\n(2, 2, 4) 出现 2 次;\n(2, 3, 3) 出现 2 次。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,1,2,2,2,2], target = 5\n<strong>输出:</strong>12\n<strong>解释:</strong>\narr[i] = 1, arr[j] = arr[k] = 2 出现 12 次:\n我们从 [1,1] 中选择一个 1,有 2 种情况,\n从 [2,2,2,2] 中选出两个 2,有 6 种情况。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 3000</code></li>\n\t<li><code>0 <= arr[i] <= 100</code></li>\n\t<li><code>0 <= target <= 300</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 93,
|
||||
"likes": 94,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"20.8K\", \"totalAcceptedRaw\": 7247, \"totalSubmissionRaw\": 20790, \"acRate\": \"34.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.5K\", \"totalSubmission\": \"21.4K\", \"totalAcceptedRaw\": 7536, \"totalSubmissionRaw\": 21396, \"acRate\": \"35.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
@ -179,7 +179,7 @@
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"exampleTestcases": "[1,1,2,2,3,3,4,4,5,5]\n8\n[1,1,2,2,2,2]\n5",
|
||||
"exampleTestcases": "[1,1,2,2,3,3,4,4,5,5]\n8\n[1,1,2,2,2,2]\n5\n[2,1,3]\n6",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个包含 <code>n</code> 个整数的数组 <code>nums</code>,判断 <code>nums</code> 中是否存在三个元素 <em>a,b,c ,</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?",
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定两个单链表的头节点 <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> </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 '8'\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>示例 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 = 2, listA = [0,9,1,2,4], listB = [3,2,4], skipA = 3, skipB = 1\n<strong>输出:</strong>Intersected at '2'\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>示例 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> </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 <= m, n <= 3 * 10<sup>4</sup></code></li>\n\t<li><code>1 <= Node.val <= 10<sup>5</sup></code></li>\n\t<li><code>0 <= skipA <= m</code></li>\n\t<li><code>0 <= skipB <= 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> </p>\n\n<p><strong>进阶:</strong>能否设计一个时间复杂度 <code>O(n)</code> 、仅用 <code>O(1)</code> 内存的解决方案?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 160 题相同:<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": 31,
|
||||
"likes": 34,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -132,7 +132,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"16.9K\", \"totalSubmission\": \"24.2K\", \"totalAcceptedRaw\": 16898, \"totalSubmissionRaw\": 24197, \"acRate\": \"69.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"19.5K\", \"totalSubmission\": \"27.9K\", \"totalAcceptedRaw\": 19543, \"totalSubmissionRaw\": 27944, \"acRate\": \"69.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个可能有重复数字的整数数组 <code>candidates</code> 和一个目标数 <code>target</code> ,找出 <code>candidates</code> 中所有可以使数字和为 <code>target</code> 的组合。</p>\n\n<p><code>candidates</code> 中的每个数字在每个组合中只能使用一次,解集不能包含重复的组合。 </p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> candidates = <code>[10,1,2,7,6,1,5]</code>, target = <code>8</code>,\n<strong>输出:</strong>\n[\n[1,1,6],\n[1,2,5],\n[1,7],\n[2,6]\n]</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> candidates = [2,5,2,1,2], target = 5,\n<strong>输出:</strong>\n[\n[1,2,2],\n[5]\n]</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= candidates.length <= 100</code></li>\n\t<li><code>1 <= candidates[i] <= 50</code></li>\n\t<li><code>1 <= target <= 30</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 40 题相同: <a href=\"https://leetcode-cn.com/problems/combination-sum-ii/\">https://leetcode-cn.com/problems/combination-sum-ii/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 18,
|
||||
"likes": 20,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 9054, \"totalSubmissionRaw\": 13869, \"acRate\": \"65.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"15.9K\", \"totalAcceptedRaw\": 10418, \"totalSubmissionRaw\": 15895, \"acRate\": \"65.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -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 <= i, j, k, l < n</code></li>\n\t<li><code>nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0</code></li>\n</ul>\n\n<p> </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) -> nums1[0] + nums2[0] + nums3[0] + nums4[1] = 1 + (-2) + (-1) + 2 = 0\n2. (1, 1, 0, 0) -> 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> </p>\n\n<p> <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 <= n <= 200</code></li>\n\t<li><code>-2<sup>28</sup> <= nums1[i], nums2[i], nums3[i], nums4[i] <= 2<sup>28</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 531,
|
||||
"likes": 558,
|
||||
"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.7K\", \"totalSubmission\": \"174.8K\", \"totalAcceptedRaw\": 108734, \"totalSubmissionRaw\": 174813, \"acRate\": \"62.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"115.4K\", \"totalSubmission\": \"184.7K\", \"totalAcceptedRaw\": 115414, \"totalSubmissionRaw\": 184743, \"acRate\": \"62.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个由 <code>n</code> 个整数组成的数组 <code>nums</code> ,和一个目标值 <code>target</code> 。请你找出并返回满足下述全部条件且<strong>不重复</strong>的四元组 <code>[nums[a], nums[b], nums[c], nums[d]]</code> (若两个四元组元素一一对应,则认为两个四元组重复):</p>\n\n<ul>\n\t<li><code>0 <= a, b, c, d < 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> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 200</code></li>\n\t<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>\n\t<li><code>-10<sup>9</sup> <= target <= 10<sup>9</sup></code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 1174,
|
||||
"likes": 1212,
|
||||
"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\": \"289.4K\", \"totalSubmission\": \"736.4K\", \"totalAcceptedRaw\": 289382, \"totalSubmissionRaw\": 736414, \"acRate\": \"39.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"305.8K\", \"totalSubmission\": \"778K\", \"totalAcceptedRaw\": 305845, \"totalSubmissionRaw\": 778049, \"acRate\": \"39.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定<strong>循环单调非递减列表</strong>中的一个点,写一个函数向这个列表中插入一个新元素 <code>insertVal</code> ,使这个列表仍然是循环升序的。</p>\n\n<p>给定的可以是这个列表中任意一个顶点的指针,并不一定是这个列表中最小元素的指针。</p>\n\n<p>如果有多个满足条件的插入位置,可以选择任意一个位置插入新的值,插入后整个列表仍然保持有序。</p>\n\n<p>如果列表为空(给定的节点是 <code>null</code>),需要创建一个循环有序列表并返回这个节点。否则。请返回原先给定的节点。</p>\n\n<p> </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 </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= Number of Nodes <= 5 * 10^4</code></li>\n\t<li><code><font face=\"monospace\">-10^6 <= Node.val <= 10^6</font></code></li>\n\t<li><code>-10^6 <= insertVal <= 10^6</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 708 题相同: <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": 36,
|
||||
"likes": 42,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -120,7 +120,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.9K\", \"totalSubmission\": \"32.2K\", \"totalAcceptedRaw\": 9866, \"totalSubmissionRaw\": 32242, \"acRate\": \"30.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.7K\", \"totalSubmission\": \"38.3K\", \"totalAcceptedRaw\": 11741, \"totalSubmissionRaw\": 38297, \"acRate\": \"30.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "小力将 N 个零件的报价存于数组 `nums`。小力预算为 `target`,假定小力仅购买两个零件,要求购买零件的花费不超过预算,请问他有多少种采购方案。\n\n注意:答案需要以 `1e9 + 7 (1000000007)` 为底取模,如:计算初始结果为:`1000000008`,请返回 `1`\n\n\n**示例 1:**\n>输入:`nums = [2,5,3,5], target = 6`\n>\n>输出:`1`\n>\n>解释:预算内仅能购买 nums[0] 与 nums[2]。\n\n**示例 2:**\n>输入:`nums = [2,2,1,9], target = 10`\n>\n>输出:`4`\n>\n>解释:符合预算的采购方案如下:\n>nums[0] + nums[1] = 4\n>nums[0] + nums[2] = 3\n>nums[1] + nums[2] = 3\n>nums[2] + nums[3] = 10\n\n**提示:**\n- `2 <= nums.length <= 10^5`\n- `1 <= nums[i], target <= 10^5`\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 42,
|
||||
"likes": 47,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"13.6K\", \"totalSubmission\": \"45.3K\", \"totalAcceptedRaw\": 13569, \"totalSubmissionRaw\": 45283, \"acRate\": \"30.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"14.5K\", \"totalSubmission\": \"47.5K\", \"totalAcceptedRaw\": 14478, \"totalSubmissionRaw\": 47544, \"acRate\": \"30.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个 24 小时制(小时:分钟 <strong>"HH:MM"</strong>)的时间列表,找出列表中任意两个时间的最小时间差并以分钟数表示。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>timePoints = ["23:59","00:00"]\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>timePoints = ["00:00","23:59","00:00"]\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= timePoints <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>timePoints[i]</code> 格式为 <strong>"HH:MM"</strong></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 539 题相同: <a href=\"https://leetcode-cn.com/problems/minimum-time-difference/\">https://leetcode-cn.com/problems/minimum-time-difference/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 13,
|
||||
"likes": 16,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.2K\", \"totalSubmission\": \"15.4K\", \"totalAcceptedRaw\": 10232, \"totalSubmissionRaw\": 15357, \"acRate\": \"66.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.3K\", \"totalSubmission\": \"18.4K\", \"totalAcceptedRaw\": 12294, \"totalSubmissionRaw\": 18433, \"acRate\": \"66.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "小扣在秋日市集入口处发现了一个数字游戏。主办方共有 `N` 个计数器,计数器编号为 `0 ~ N-1`。每个计数器上分别显示了一个数字,小扣按计数器编号升序将所显示的数字记于数组 `nums`。每个计数器上有两个按钮,分别可以实现将显示数字加一或减一。小扣每一次操作可以选择一个计数器,按下加一或减一按钮。\n\n主办方请小扣回答出一个长度为 `N` 的数组,第 `i` 个元素(0 <= i < N)表示将 `0~i` 号计数器 **初始** 所示数字操作成满足所有条件 `nums[a]+1 == nums[a+1],(0 <= a < i)` 的最小操作数。回答正确方可进入秋日市集。\n\n由于答案可能很大,请将每个最小操作数对 `1,000,000,007` 取余。\n\n\n**示例 1:**\n>输入:`nums = [3,4,5,1,6,7]`\n>\n>输出:`[0,0,0,5,6,7]`\n>\n>解释:\n>i = 0,[3] 无需操作\n>i = 1,[3,4] 无需操作;\n>i = 2,[3,4,5] 无需操作;\n>i = 3,将 [3,4,5,1] 操作成 [3,4,5,6], 最少 5 次操作;\n>i = 4,将 [3,4,5,1,6] 操作成 [3,4,5,6,7], 最少 6 次操作;\n>i = 5,将 [3,4,5,1,6,7] 操作成 [3,4,5,6,7,8],最少 7 次操作;\n>返回 [0,0,0,5,6,7]。\n\n\n**示例 2:**\n>输入:`nums = [1,2,3,4,5]`\n>\n>输出:`[0,0,0,0,0]`\n>\n>解释:对于任意计数器编号 i 都无需操作。\n\n**示例 3:**\n>输入:`nums = [1,1,1,2,3,4]`\n>\n>输出:`[0,1,2,3,3,3]`\n>\n>解释:\n>i = 0,无需操作;\n>i = 1,将 [1,1] 操作成 [1,2] 或 [0,1] 最少 1 次操作;\n>i = 2,将 [1,1,1] 操作成 [1,2,3] 或 [0,1,2],最少 2 次操作;\n>i = 3,将 [1,1,1,2] 操作成 [1,2,3,4] 或 [0,1,2,3],最少 3 次操作;\n>i = 4,将 [1,1,1,2,3] 操作成 [-1,0,1,2,3],最少 3 次操作;\n>i = 5,将 [1,1,1,2,3,4] 操作成 [-1,0,1,2,3,4],最少 3 次操作;\n>返回 [0,1,2,3,3,3]。\n\n\n**提示:**\n- `1 <= nums.length <= 10^5`\n- `1 <= nums[i] <= 10^3`\n\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 22,
|
||||
"likes": 23,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1059, \"totalSubmissionRaw\": 3607, \"acRate\": \"29.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"3.7K\", \"totalAcceptedRaw\": 1116, \"totalSubmissionRaw\": 3700, \"acRate\": \"30.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"3.7K\", \"totalAcceptedRaw\": 1153, \"totalSubmissionRaw\": 3715, \"acRate\": \"31.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"3.7K\", \"totalAcceptedRaw\": 1154, \"totalSubmissionRaw\": 3716, \"acRate\": \"31.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个二叉树的根节点 <code>root</code> ,和一个整数 <code>targetSum</code> ,求该二叉树里节点值之和等于 <code>targetSum</code> 的 <strong>路径</strong> 的数目。</p>\n\n<p><strong>路径</strong> 不需要从根节点开始,也不需要在叶子节点结束,但是路径方向必须是向下的(只能从父节点到子节点)。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2021/04/09/pathsum3-1-tree.jpg\" style=\"width: 452px; \" /></p>\n\n<pre>\n<strong>输入:</strong>root = [10,5,-3,3,2,null,11,3,-2,null,1], targetSum = 8\n<strong>输出:</strong>3\n<strong>解释:</strong>和等于 8 的路径有 3 条,如图所示。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>root = [5,4,8,11,null,13,4,7,2,null,null,5,1], targetSum = 22\n<strong>输出:</strong>3\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>二叉树的节点个数的范围是 <code>[0,1000]</code></li>\n\t<li><meta charset=\"UTF-8\" /><code>-10<sup><span style=\"font-size: 9.449999809265137px;\">9</span></sup> <= Node.val <= 10<sup><span style=\"font-size: 9.449999809265137px;\">9</span></sup></code> </li>\n\t<li><code>-1000 <= targetSum <= 1000</code> </li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 437 题相同:<a href=\"https://leetcode-cn.com/problems/path-sum-iii/\">https://leetcode-cn.com/problems/path-sum-iii/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 27,
|
||||
"likes": 33,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.1K\", \"totalSubmission\": \"15K\", \"totalAcceptedRaw\": 9085, \"totalSubmissionRaw\": 14985, \"acRate\": \"60.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.9K\", \"totalSubmission\": \"18.1K\", \"totalAcceptedRaw\": 10894, \"totalSubmissionRaw\": 18059, \"acRate\": \"60.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>树可以看成是一个连通且 <strong>无环 </strong>的 <strong>无向 </strong>图。</p>\n\n<p>给定往一棵 <code>n</code> 个节点 (节点值 <code>1~n</code>) 的树中添加一条边后的图。添加的边的两个顶点包含在 <code>1</code> 到 <code>n</code> 中间,且这条附加的边不属于树中已存在的边。图的信息记录于长度为 <code>n</code> 的二维数组 <code>edges</code> ,<code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> 表示图中在 <code>ai</code> 和 <code>bi</code> 之间存在一条边。</p>\n\n<p>请找出一条可以删去的边,删除后可使得剩余部分是一个有着 <code>n</code> 个节点的树。如果有多个答案,则返回数组 <code>edges</code> 中最后出现的边。</p>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>n == edges.length</code></li>\n\t<li><code>3 <= n <= 1000</code></li>\n\t<li><code>edges[i].length == 2</code></li>\n\t<li><code>1 <= ai < bi <= edges.length</code></li>\n\t<li><code>ai != bi</code></li>\n\t<li><code>edges</code> 中无重复元素</li>\n\t<li>给定的图是连通的 </li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 684 题相同: <a href=\"https://leetcode-cn.com/problems/redundant-connection/\">https://leetcode-cn.com/problems/redundant-connection/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 18,
|
||||
"likes": 23,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.6K\", \"totalSubmission\": \"5.2K\", \"totalAcceptedRaw\": 3577, \"totalSubmissionRaw\": 5154, \"acRate\": \"69.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.3K\", \"totalSubmission\": \"6.2K\", \"totalAcceptedRaw\": 4315, \"totalSubmissionRaw\": 6180, \"acRate\": \"69.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定链表的头结点 <code>head</code> ,请将其按 <strong>升序</strong> 排列并返回 <strong>排序后的链表</strong> 。</p>\n\n<ul>\n</ul>\n\n<p> </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> </p>\n\n<p><b>提示:</b></p>\n\n<ul>\n\t<li>链表中节点的数目在范围 <code>[0, 5 * 10<sup>4</sup>]</code> 内</li>\n\t<li><code>-10<sup>5</sup> <= Node.val <= 10<sup>5</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><b>进阶:</b>你可以在 <code>O(n log n)</code> 时间复杂度和常数级空间复杂度下,对链表进行排序吗?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 148 题相同:<a href=\"https://leetcode-cn.com/problems/sort-list/\">https://leetcode-cn.com/problems/sort-list/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 44,
|
||||
"likes": 52,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -168,7 +168,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"12.9K\", \"totalSubmission\": \"21.2K\", \"totalAcceptedRaw\": 12897, \"totalSubmissionRaw\": 21218, \"acRate\": \"60.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"15.6K\", \"totalSubmission\": \"25.8K\", \"totalAcceptedRaw\": 15647, \"totalSubmissionRaw\": 25795, \"acRate\": \"60.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> 和两个整数 <code>k</code> 和 <code>t</code> 。请你判断是否存在 <b>两个不同下标</b> <code>i</code> 和 <code>j</code>,使得 <code>abs(nums[i] - nums[j]) <= t</code> ,同时又满足 <code>abs(i - j) <= k</code><em> </em>。</p>\n\n<p>如果存在则返回 <code>true</code>,不存在返回 <code>false</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,1], k<em> </em>= 3, t = 0\n<strong>输出:</strong>true</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,0,1,1], k<em> </em>=<em> </em>1, t = 2\n<strong>输出:</strong>true</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,5,9,1,5,9], k = 2, t = 3\n<strong>输出:</strong>false</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= nums.length <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>-2<sup>31</sup> <= nums[i] <= 2<sup>31</sup> - 1</code></li>\n\t<li><code>0 <= k <= 10<sup>4</sup></code></li>\n\t<li><code>0 <= t <= 2<sup>31</sup> - 1</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 220 题相同: <a href=\"https://leetcode-cn.com/problems/contains-duplicate-iii/\">https://leetcode-cn.com/problems/contains-duplicate-iii/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 33,
|
||||
"likes": 35,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -168,7 +168,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"17.8K\", \"totalAcceptedRaw\": 6224, \"totalSubmissionRaw\": 17806, \"acRate\": \"35.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.6K\", \"totalSubmission\": \"21.7K\", \"totalAcceptedRaw\": 7552, \"totalSubmissionRaw\": 21737, \"acRate\": \"34.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"12.6K\", \"totalAcceptedRaw\": 8678, \"totalSubmissionRaw\": 12567, \"acRate\": \"69.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"14.6K\", \"totalAcceptedRaw\": 10072, \"totalSubmissionRaw\": 14560, \"acRate\": \"69.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"646\", \"totalSubmission\": \"1.1K\", \"totalAcceptedRaw\": 646, \"totalSubmissionRaw\": 1053, \"acRate\": \"61.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"739\", \"totalSubmission\": \"1.2K\", \"totalAcceptedRaw\": 739, \"totalSubmissionRaw\": 1163, \"acRate\": \"63.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>根据<a href=\"https://baike.baidu.com/item/%E9%80%86%E6%B3%A2%E5%85%B0%E5%BC%8F/128437\" target=\"_blank\"> 逆波兰表示法</a>,求该后缀表达式的计算结果。</p>\n\n<p>有效的算符包括 <code>+</code>、<code>-</code>、<code>*</code>、<code>/</code> 。每个运算对象可以是整数,也可以是另一个逆波兰表达式。</p>\n\n<p> </p>\n\n<p><strong>说明:</strong></p>\n\n<ul>\n\t<li>整数除法只保留整数部分。</li>\n\t<li>给定逆波兰表达式总是有效的。换句话说,表达式总会得出有效数值且不存在除数为 0 的情况。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>tokens = ["2","1","+","3","*"]\n<strong>输出:</strong>9\n<strong>解释:</strong>该算式转化为常见的中缀算术表达式为:((2 + 1) * 3) = 9\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>tokens = ["4","13","5","/","+"]\n<strong>输出:</strong>6\n<strong>解释:</strong>该算式转化为常见的中缀算术表达式为:(4 + (13 / 5)) = 6\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"]\n<strong>输出:</strong>22\n<strong>解释:</strong>\n该算式转化为常见的中缀算术表达式为:\n ((10 * (6 / ((9 + 3) * -11))) + 17) + 5\n= ((10 * (6 / (12 * -11))) + 17) + 5\n= ((10 * (6 / -132)) + 17) + 5\n= ((10 * 0) + 17) + 5\n= (0 + 17) + 5\n= 17 + 5\n= 22</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= tokens.length <= 10<sup>4</sup></code></li>\n\t<li><code>tokens[i]</code> 要么是一个算符(<code>"+"</code>、<code>"-"</code>、<code>"*"</code> 或 <code>"/"</code>),要么是一个在范围 <code>[-200, 200]</code> 内的整数</li>\n</ul>\n\n<p> </p>\n\n<p><strong>逆波兰表达式:</strong></p>\n\n<p>逆波兰表达式是一种后缀表达式,所谓后缀就是指算符写在后面。</p>\n\n<ul>\n\t<li>平常使用的算式则是一种中缀表达式,如 <code>( 1 + 2 ) * ( 3 + 4 )</code> 。</li>\n\t<li>该算式的逆波兰表达式写法为 <code>( ( 1 2 + ) ( 3 4 + ) * )</code> 。</li>\n</ul>\n\n<p>逆波兰表达式主要有以下两个优点:</p>\n\n<ul>\n\t<li>去掉括号后表达式无歧义,上式即便写成 <code>1 2 + 3 4 + * </code>也可以依据次序计算出正确结果。</li>\n\t<li>适合用栈操作运算:遇到数字则入栈;遇到算符则取出栈顶两个数字进行计算,并将结果压入栈中。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 150 题相同: <a href=\"https://leetcode-cn.com/problems/evaluate-reverse-polish-notation/\">https://leetcode-cn.com/problems/evaluate-reverse-polish-notation/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 15,
|
||||
"likes": 17,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.3K\", \"totalSubmission\": \"18.2K\", \"totalAcceptedRaw\": 10292, \"totalSubmissionRaw\": 18173, \"acRate\": \"56.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.3K\", \"totalSubmission\": \"21.8K\", \"totalAcceptedRaw\": 12261, \"totalSubmissionRaw\": 21762, \"acRate\": \"56.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -9,10 +9,10 @@
|
||||
"titleSlug": "A1NYOS",
|
||||
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>\n",
|
||||
"translatedTitle": "0 和 1 个数相同的子数组",
|
||||
"translatedContent": "<p>给定一个二进制数组 <code>nums</code> , 找到含有相同数量的 <code>0</code> 和 <code>1</code> 的最长连续子数组,并返回该子数组的长度。</p>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 525 题相同: <a href=\"https://leetcode-cn.com/problems/contiguous-array/\">https://leetcode-cn.com/problems/contiguous-array/</a></p>\n",
|
||||
"translatedContent": "<p>给定一个二进制数组 <code>nums</code> , 找到含有相同数量的 <code>0</code> 和 <code>1</code> 的最长连续子数组,并返回该子数组的长度。</p>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>nums[i]</code> 不是 <code>0</code> 就是 <code>1</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 525 题相同: <a href=\"https://leetcode-cn.com/problems/contiguous-array/\">https://leetcode-cn.com/problems/contiguous-array/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 49,
|
||||
"likes": 62,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"27.1K\", \"totalAcceptedRaw\": 15146, \"totalSubmissionRaw\": 27117, \"acRate\": \"55.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"17.8K\", \"totalSubmission\": \"32K\", \"totalAcceptedRaw\": 17817, \"totalSubmissionRaw\": 31960, \"acRate\": \"55.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
@ -185,7 +185,7 @@
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"exampleTestcases": "",
|
||||
"exampleTestcases": "[0,1]\n[0,1,0]",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>符合下列属性的数组 <code>arr</code> 称为 <strong>山峰数组</strong>(<strong>山脉数组)</strong> :</p>\n\n<ul>\n\t<li><code>arr.length >= 3</code></li>\n\t<li>存在 <code>i</code>(<code>0 < i < arr.length - 1</code>)使得:\n\t<ul>\n\t\t<li><code>arr[0] < arr[1] < ... arr[i-1] < arr[i] </code></li>\n\t\t<li><code>arr[i] > arr[i+1] > ... > arr[arr.length - 1]</code></li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>给定由整数组成的山峰数组 <code>arr</code> ,返回任何满足 <code>arr[0] < arr[1] < ... arr[i - 1] < arr[i] > arr[i + 1] > ... > arr[arr.length - 1]</code> 的下标 <code>i</code> ,即山峰顶部。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [0,1,0]\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [1,3,5,4,2]\n<strong>输出:2</strong>\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [0,10,5,2]\n<strong>输出:</strong>1\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [3,4,5,1]\n<strong>输出:</strong>2\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>arr = [24,69,100,99,79,78,67,36,26,19]\n<strong>输出:</strong>2\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 10<sup>4</sup></code></li>\n\t<li><code>0 <= arr[i] <= 10<sup>6</sup></code></li>\n\t<li>题目数据保证 <code>arr</code> 是一个山脉数组</li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>很容易想到时间复杂度 <code>O(n)</code> 的解决方案,你可以设计一个 <code>O(log(n))</code> 的解决方案吗?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 852 题相同:<a href=\"https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/\">https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 76,
|
||||
"likes": 80,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"44.3K\", \"totalSubmission\": \"62.1K\", \"totalAcceptedRaw\": 44329, \"totalSubmissionRaw\": 62077, \"acRate\": \"71.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"46.5K\", \"totalSubmission\": \"65.3K\", \"totalAcceptedRaw\": 46496, \"totalSubmissionRaw\": 65320, \"acRate\": \"71.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个由 <strong>不同</strong> 正整数组成的数组 <code>nums</code> ,和一个目标整数 <code>target</code> 。请从 <code>nums</code> 中找出并返回总和为 <code>target</code> 的元素组合的个数。数组中的数字可以在一次排列中出现任意次,但是顺序不同的序列被视作不同的组合。</p>\n\n<p>题目数据保证答案符合 32 位整数范围。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3], target = 4\n<strong>输出:</strong>7\n<strong>解释:</strong>\n所有可能的组合为:\n(1, 1, 1, 1)\n(1, 1, 2)\n(1, 2, 1)\n(1, 3)\n(2, 1, 1)\n(2, 2)\n(3, 1)\n请注意,顺序不同的序列被视作不同的组合。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [9], target = 3\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 200</code></li>\n\t<li><code>1 <= nums[i] <= 1000</code></li>\n\t<li><code>nums</code> 中的所有元素 <strong>互不相同</strong></li>\n\t<li><code>1 <= target <= 1000</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>如果给定的数组中含有负数会发生什么?问题会产生何种变化?如果允许负数出现,需要向题目中添加哪些限制条件?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 377 题相同:<a href=\"https://leetcode-cn.com/problems/combination-sum-iv/\">https://leetcode-cn.com/problems/combination-sum-iv/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 20,
|
||||
"likes": 22,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.7K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 4677, \"totalSubmissionRaw\": 7900, \"acRate\": \"59.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.6K\", \"totalSubmission\": \"9.5K\", \"totalAcceptedRaw\": 5578, \"totalSubmissionRaw\": 9490, \"acRate\": \"58.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.6K\", \"totalSubmission\": \"3.5K\", \"totalAcceptedRaw\": 1568, \"totalSubmissionRaw\": 3540, \"acRate\": \"44.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.7K\", \"totalSubmission\": \"3.8K\", \"totalAcceptedRaw\": 1731, \"totalSubmissionRaw\": 3757, \"acRate\": \"46.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "某解密游戏中,有一个 N\\*M 的迷宫,迷宫地形会随时间变化而改变,迷宫出口一直位于 `(n-1,m-1)` 位置。迷宫变化规律记录于 `maze` 中,`maze[i]` 表示 `i` 时刻迷宫的地形状态,`\".\"` 表示可通行空地,`\"#\"` 表示陷阱。\n\n地形图初始状态记作 `maze[0]`,此时小力位于起点 `(0,0)`。此后每一时刻可选择往上、下、左、右其一方向走一步,或者停留在原地。\n\n小力背包有以下两个魔法卷轴(卷轴使用一次后消失):\n+ 临时消除术:将指定位置在下一个时刻变为空地;\n+ 永久消除术:将指定位置永久变为空地。\n\n请判断在迷宫变化结束前(含最后时刻),小力能否在不经过任意陷阱的情况下到达迷宫出口呢?\n\n**注意: 输入数据保证起点和终点在所有时刻均为空地。**\n\n**示例 1:**\n>输入:`maze = [[\".#.\",\"#..\"],[\"...\",\".#.\"],[\".##\",\".#.\"],[\"..#\",\".#.\"]]`\n>\n>输出:`true`\n>\n>解释:\n\n\n\n**示例 2:**\n>输入:`maze = [[\".#.\",\"...\"],[\"...\",\"...\"]]`\n>\n>输出:`false`\n>\n>解释:由于时间不够,小力无法到达终点逃出迷宫。\n\n**示例 3:**\n>输入:`maze = [[\"...\",\"...\",\"...\"],[\".##\",\"###\",\"##.\"],[\".##\",\"###\",\"##.\"],[\".##\",\"###\",\"##.\"],[\".##\",\"###\",\"##.\"],[\".##\",\"###\",\"##.\"],[\".##\",\"###\",\"##.\"]]`\n>\n>输出:`false`\n>\n>解释:由于道路不通,小力无法到达终点逃出迷宫。\n\n**提示:**\n- `1 <= maze.length <= 100`\n- `1 <= maze[i].length, maze[i][j].length <= 50`\n- `maze[i][j]` 仅包含 `\".\"`、`\"#\"`",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 27,
|
||||
"likes": 28,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -161,7 +161,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.2K\", \"totalSubmission\": \"7.9K\", \"totalAcceptedRaw\": 2153, \"totalSubmissionRaw\": 7935, \"acRate\": \"27.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.3K\", \"totalSubmission\": \"8.3K\", \"totalAcceptedRaw\": 2331, \"totalSubmissionRaw\": 8266, \"acRate\": \"28.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"125\", \"totalSubmission\": \"690\", \"totalAcceptedRaw\": 125, \"totalSubmissionRaw\": 690, \"acRate\": \"18.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"126\", \"totalSubmission\": \"691\", \"totalAcceptedRaw\": 126, \"totalSubmissionRaw\": 691, \"acRate\": \"18.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>设计一个支持在<em>平均 </em>时间复杂度 <strong>O(1)</strong> 下,执行以下操作的数据结构:</p>\n\n<ul>\n\t<li><code>insert(val)</code>:当元素 <code>val</code> 不存在时返回 <code>true</code> ,并向集合中插入该项,否则返回 <code>false</code> 。</li>\n\t<li><code>remove(val)</code>:当元素 <code>val</code> 存在时返回 <code>true</code> ,并从集合中移除该项,否则返回 <code>false</code> 。</li>\n\t<li><code>getRandom</code>:随机返回现有集合中的一项。每个元素应该有 <strong>相同的概率 </strong>被返回。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 :</strong></p>\n\n<pre>\n<strong>输入: </strong>inputs = ["RandomizedSet", "insert", "remove", "insert", "getRandom", "remove", "insert", "getRandom"]\n[[], [1], [2], [2], [], [1], [2], []]\n<strong>输出: </strong>[null, true, false, true, 2, true, false, 2]\n<strong>解释:\n</strong>RandomizedSet randomSet = new RandomizedSet(); // 初始化一个空的集合\nrandomSet.insert(1); // 向集合中插入 1 , 返回 true 表示 1 被成功地插入\n\nrandomSet.remove(2); // 返回 false,表示集合中不存在 2 \n\nrandomSet.insert(2); // 向集合中插入 2 返回 true ,集合现在包含 [1,2] \n\nrandomSet.getRandom(); // getRandom 应随机返回 1 或 2 \n \nrandomSet.remove(1); // 从集合中移除 1 返回 true 。集合现在包含 [2] \n\nrandomSet.insert(2); // 2 已在集合中,所以返回 false \n\nrandomSet.getRandom(); // 由于 2 是集合中唯一的数字,getRandom 总是返回 2 \n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong><meta charset=\"UTF-8\" /></p>\n\n<ul>\n\t<li><code>-2<sup>31</sup> <= val <= 2<sup>31</sup> - 1</code></li>\n\t<li>最多进行<code> 2 * 10<sup>5</sup></code> 次 <code>insert</code> , <code>remove</code> 和 <code>getRandom</code> 方法调用</li>\n\t<li>当调用 <code>getRandom</code> 方法时,集合中至少有一个元素</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 380 题相同:<a href=\"https://leetcode-cn.com/problems/insert-delete-getrandom-o1/\">https://leetcode-cn.com/problems/insert-delete-getrandom-o1/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 24,
|
||||
"likes": 31,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -168,7 +168,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.6K\", \"totalSubmission\": \"15.9K\", \"totalAcceptedRaw\": 8637, \"totalSubmissionRaw\": 15891, \"acRate\": \"54.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.2K\", \"totalSubmission\": \"18.8K\", \"totalAcceptedRaw\": 10227, \"totalSubmissionRaw\": 18817, \"acRate\": \"54.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>一个专业的小偷,计划偷窃沿街的房屋。每间房内都藏有一定的现金,影响小偷偷窃的唯一制约因素就是相邻的房屋装有相互连通的防盗系统,<strong>如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警</strong>。</p>\n\n<p>给定一个代表每个房屋存放金额的非负整数数组 <code>nums</code> ,请计算<strong> 不触动警报装置的情况下 </strong>,一夜之内能够偷窃到的最高金额。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums =<strong> </strong>[1,2,3,1]\n<strong>输出:</strong>4\n<strong>解释:</strong>偷窃 1 号房屋 (金额 = 1) ,然后偷窃 3 号房屋 (金额 = 3)。\n 偷窃到的最高金额 = 1 + 3 = 4 。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums =<strong> </strong>[2,7,9,3,1]\n<strong>输出:</strong>12\n<strong>解释:</strong>偷窃 1 号房屋 (金额 = 2), 偷窃 3 号房屋 (金额 = 9),接着偷窃 5 号房屋 (金额 = 1)。\n 偷窃到的最高金额 = 2 + 9 + 1 = 12 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 100</code></li>\n\t<li><code>0 <= nums[i] <= 400</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 198 题相同: <a href=\"https://leetcode-cn.com/problems/house-robber/\">https://leetcode-cn.com/problems/house-robber/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 15,
|
||||
"likes": 18,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 9248, \"totalSubmissionRaw\": 15115, \"acRate\": \"61.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.8K\", \"totalSubmission\": \"17.7K\", \"totalAcceptedRaw\": 10769, \"totalSubmissionRaw\": 17661, \"acRate\": \"61.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>数组的每个下标作为一个阶梯,第 <code>i</code> 个阶梯对应着一个非负数的体力花费值 <code>cost[i]</code>(下标从 <code>0</code> 开始)。</p>\n\n<p>每当爬上一个阶梯都要花费对应的体力值,一旦支付了相应的体力值,就可以选择向上爬一个阶梯或者爬两个阶梯。</p>\n\n<p>请找出达到楼层顶部的最低花费。在开始时,你可以选择从下标为 0 或 1 的元素作为初始阶梯。</p>\n\n<p> </p>\n\n<p><strong>示例 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> 示例 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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= cost.length <= 1000</code></li>\n\t<li><code>0 <= cost[i] <= 999</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 746 题相同: <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": 35,
|
||||
"likes": 37,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"13.3K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 13257, \"totalSubmissionRaw\": 17936, \"acRate\": \"73.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"15.4K\", \"totalSubmission\": \"20.9K\", \"totalAcceptedRaw\": 15443, \"totalSubmissionRaw\": 20903, \"acRate\": \"73.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -7,12 +7,12 @@
|
||||
"boundTopicId": 910311,
|
||||
"title": "相似的字符串",
|
||||
"titleSlug": "H6lPxb",
|
||||
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>\n",
|
||||
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>",
|
||||
"translatedTitle": "相似的字符串",
|
||||
"translatedContent": "<p>如果交换字符串 <code>X</code> 中的两个不同位置的字母,使得它和字符串 <code>Y</code> 相等,那么称 <code>X</code> 和 <code>Y</code> 两个字符串相似。如果这两个字符串本身是相等的,那它们也是相似的。</p>\n\n<p>例如,<code>"tars"</code> 和 <code>"rats"</code> 是相似的 (交换 <code>0</code> 与 <code>2</code> 的位置); <code>"rats"</code> 和 <code>"arts"</code> 也是相似的,但是 <code>"star"</code> 不与 <code>"tars"</code>,<code>"rats"</code>,或 <code>"arts"</code> 相似。</p>\n\n<p>总之,它们通过相似性形成了两个关联组:<code>{"tars", "rats", "arts"}</code> 和 <code>{"star"}</code>。注意,<code>"tars"</code> 和 <code>"arts"</code> 是在同一组中,即使它们并不相似。形式上,对每个组而言,要确定一个单词在组中,只需要这个词和该组中至少一个单词相似。</p>\n\n<p>给定一个字符串列表 <code>strs</code>。列表中的每个字符串都是 <code>strs</code> 中其它所有字符串的一个 <strong>字母异位词 </strong>。请问 <code>strs</code> 中有多少个相似字符串组?</p>\n\n<p><strong>字母异位词(anagram)</strong>,一种把某个字符串的字母的位置(顺序)加以改换所形成的新词。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>strs = ["tars","rats","arts","star"]\n<strong>输出:</strong>2\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>strs = ["omv","ovm"]\n<strong>输出:</strong>1\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= strs.length <= 300</code></li>\n\t<li><code>1 <= strs[i].length <= 300</code></li>\n\t<li><code>strs[i]</code> 只包含小写字母。</li>\n\t<li><code>strs</code> 中的所有单词都具有相同的长度,且是彼此的字母异位词。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 839 题相同:<a href=\"https://leetcode-cn.com/problems/similar-string-groups/\">https://leetcode-cn.com/problems/similar-string-groups/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 9,
|
||||
"likes": 10,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -44,6 +44,12 @@
|
||||
"translatedName": "并查集",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Array",
|
||||
"slug": "array",
|
||||
"translatedName": "数组",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "String",
|
||||
"slug": "string",
|
||||
@ -162,7 +168,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"4.6K\", \"totalAcceptedRaw\": 2911, \"totalSubmissionRaw\": 4595, \"acRate\": \"63.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"3.5K\", \"totalSubmission\": \"5.6K\", \"totalAcceptedRaw\": 3544, \"totalSubmissionRaw\": 5641, \"acRate\": \"62.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>写一个 <code>RecentCounter</code> 类来计算特定时间范围内最近的请求。</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> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入:</strong>\ninputs = ["RecentCounter", "ping", "ping", "ping", "ping"]\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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= t <= 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> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 933 题相同: <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": 15,
|
||||
"likes": 19,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10K\", \"totalSubmission\": \"12K\", \"totalAcceptedRaw\": 10003, \"totalSubmissionRaw\": 12027, \"acRate\": \"83.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.8K\", \"totalSubmission\": \"14.2K\", \"totalAcceptedRaw\": 11769, \"totalSubmissionRaw\": 14209, \"acRate\": \"82.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>正整数 <code>n</code> 代表生成括号的对数,请设计一个函数,用于能够生成所有可能的并且 <strong>有效的 </strong>括号组合。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 3\n<strong>输出:</strong>["((()))","(()())","(())()","()(())","()()()"]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>n = 1\n<strong>输出:</strong>["()"]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= n <= 8</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 22 题相同: <a href=\"https://leetcode-cn.com/problems/generate-parentheses/\">https://leetcode-cn.com/problems/generate-parentheses/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 25,
|
||||
"likes": 27,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.3K\", \"totalSubmission\": \"12.1K\", \"totalAcceptedRaw\": 10317, \"totalSubmissionRaw\": 12070, \"acRate\": \"85.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12K\", \"totalSubmission\": \"14.1K\", \"totalAcceptedRaw\": 12018, \"totalSubmissionRaw\": 14097, \"acRate\": \"85.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"4.1K\", \"totalAcceptedRaw\": 1354, \"totalSubmissionRaw\": 4092, \"acRate\": \"33.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"4.2K\", \"totalAcceptedRaw\": 1416, \"totalSubmissionRaw\": 4192, \"acRate\": \"33.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.1K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 5065, \"totalSubmissionRaw\": 10708, \"acRate\": \"47.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"12.8K\", \"totalAcceptedRaw\": 6054, \"totalSubmissionRaw\": 12791, \"acRate\": \"47.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个三角形 <code>triangle</code> ,找出自顶向下的最小路径和。</p>\n\n<p>每一步只能移动到下一行中相邻的结点上。<strong>相邻的结点 </strong>在这里指的是 <strong>下标</strong> 与 <strong>上一层结点下标</strong> 相同或者等于 <strong>上一层结点下标 + 1</strong> 的两个结点。也就是说,如果正位于当前行的下标 <code>i</code> ,那么下一步可以移动到下一行的下标 <code>i</code> 或 <code>i + 1</code> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>triangle = [[2],[3,4],[6,5,7],[4,1,8,3]]\n<strong>输出:</strong>11\n<strong>解释:</strong>如下面简图所示:\n <strong>2</strong>\n <strong>3</strong> 4\n 6 <strong>5</strong> 7\n4 <strong>1</strong> 8 3\n自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>triangle = [[-10]]\n<strong>输出:</strong>-10\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= triangle.length <= 200</code></li>\n\t<li><code>triangle[0].length == 1</code></li>\n\t<li><code>triangle[i].length == triangle[i - 1].length + 1</code></li>\n\t<li><code>-10<sup>4</sup> <= triangle[i][j] <= 10<sup>4</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong></p>\n\n<ul>\n\t<li>你可以只使用 <code>O(n)</code> 的额外空间(<code>n</code> 为三角形的总行数)来解决这个问题吗?</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 120 题相同: <a href=\"https://leetcode-cn.com/problems/triangle/\">https://leetcode-cn.com/problems/triangle/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 9,
|
||||
"likes": 12,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.9K\", \"totalSubmission\": \"9.2K\", \"totalAcceptedRaw\": 6938, \"totalSubmissionRaw\": 9151, \"acRate\": \"75.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.2K\", \"totalSubmission\": \"10.8K\", \"totalAcceptedRaw\": 8245, \"totalSubmissionRaw\": 10834, \"acRate\": \"76.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>假如有一排房子,共 <code>n</code> 个,每个房子可以被粉刷成红色、蓝色或者绿色这三种颜色中的一种,你需要粉刷所有的房子并且使其相邻的两个房子颜色不能相同。</p>\n\n<p>当然,因为市场上不同颜色油漆的价格不同,所以房子粉刷成不同颜色的花费成本也是不同的。每个房子粉刷成不同颜色的花费是以一个 <code>n x 3</code><em> </em>的正整数矩阵 <code>costs</code> 来表示的。</p>\n\n<p>例如,<code>costs[0][0]</code> 表示第 0 号房子粉刷成红色的成本花费;<code>costs[1][2]</code> 表示第 1 号房子粉刷成绿色的花费,以此类推。</p>\n\n<p>请计算出粉刷完所有房子最少的花费成本。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>costs = [[17,2,17],[16,16,5],[14,3,19]]\n<strong>输出: </strong>10\n<strong>解释: </strong>将 0 号房子粉刷成蓝色,1 号房子粉刷成绿色,2 号房子粉刷成蓝色<strong>。</strong>\n 最少花费: 2 + 5 + 3 = 10。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>costs = [[7,6,2]]\n<strong>输出: 2</strong>\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>costs.length == n</code></li>\n\t<li><code>costs[i].length == 3</code></li>\n\t<li><code>1 <= n <= 100</code></li>\n\t<li><code>1 <= costs[i][j] <= 20</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 256 题相同:<a href=\"https://leetcode-cn.com/problems/paint-house/\">https://leetcode-cn.com/problems/paint-house/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 29,
|
||||
"likes": 33,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.8K\", \"totalSubmission\": \"10K\", \"totalAcceptedRaw\": 7762, \"totalSubmissionRaw\": 10024, \"acRate\": \"77.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"11.9K\", \"totalAcceptedRaw\": 9221, \"totalSubmissionRaw\": 11941, \"acRate\": \"77.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定两个 01 字符串 <code>a</code> 和 <code>b</code> ,请计算它们的和,并以二进制字符串的形式输出。</p>\n\n<p>输入为 <strong>非空 </strong>字符串且只包含数字 <code>1</code> 和 <code>0</code>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> a = "11", b = "10"\n<strong>输出:</strong> "101"</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> a = "1010", b = "1011"\n<strong>输出:</strong> "10101"</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>每个字符串仅由字符 <code>'0'</code> 或 <code>'1'</code> 组成。</li>\n\t<li><code>1 <= a.length, b.length <= 10^4</code></li>\n\t<li>字符串如果不是 <code>"0"</code> ,就都不含前导零。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 67 题相同:<a href=\"https://leetcode-cn.com/problems/add-binary/\">https://leetcode-cn.com/problems/add-binary/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 26,
|
||||
"likes": 30,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"24.8K\", \"totalSubmission\": \"44.5K\", \"totalAcceptedRaw\": 24787, \"totalSubmissionRaw\": 44514, \"acRate\": \"55.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"28.2K\", \"totalSubmission\": \"50.9K\", \"totalAcceptedRaw\": 28168, \"totalSubmissionRaw\": 50877, \"acRate\": \"55.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>现有一种使用英语字母的外星文语言,这门语言的字母顺序与英语顺序不同。</p>\n\n<p>给定一个字符串列表 <code>words</code> ,作为这门语言的词典,<code>words</code> 中的字符串已经 <strong>按这门新语言的字母顺序进行了排序</strong> 。</p>\n\n<p>请你根据该词典还原出此语言中已知的字母顺序,并 <strong>按字母递增顺序</strong> 排列。若不存在合法字母顺序,返回 <code>""</code> 。若存在多种可能的合法字母顺序,返回其中 <strong>任意一种</strong> 顺序即可。</p>\n\n<p>字符串 <code>s</code> <strong>字典顺序小于</strong> 字符串 <code>t</code> 有两种情况:</p>\n\n<ul>\n\t<li>在第一个不同字母处,如果 <code>s</code> 中的字母在这门外星语言的字母顺序中位于 <code>t</code> 中字母之前,那么 <code>s</code> 的字典顺序小于 <code>t</code> 。</li>\n\t<li>如果前面 <code>min(s.length, t.length)</code> 字母都相同,那么 <code>s.length < t.length</code> 时,<code>s</code> 的字典顺序也小于 <code>t</code> 。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>words = ["wrt","wrf","er","ett","rftt"]\n<strong>输出:</strong>"wertf"\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>words = ["z","x"]\n<strong>输出:</strong>"zx"\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>words = ["z","x","z"]\n<strong>输出:</strong>""\n<strong>解释:</strong>不存在合法字母顺序,因此返回 <code>"" 。</code>\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= words.length <= 100</code></li>\n\t<li><code>1 <= words[i].length <= 100</code></li>\n\t<li><code>words[i]</code> 仅由小写英文字母组成</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 269 题相同: <a href=\"https://leetcode-cn.com/problems/alien-dictionary/\">https://leetcode-cn.com/problems/alien-dictionary/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 12,
|
||||
"likes": 17,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -174,7 +174,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.5K\", \"totalSubmission\": \"5.9K\", \"totalAcceptedRaw\": 2470, \"totalSubmissionRaw\": 5905, \"acRate\": \"41.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2.9K\", \"totalSubmission\": \"7K\", \"totalAcceptedRaw\": 2941, \"totalSubmissionRaw\": 6969, \"acRate\": \"42.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "小扣打算给自己的 **VS code** 安装使用插件,初始状态下带宽每分钟可以完成 `1` 个插件的下载。假定每分钟选择以下两种策略之一:\r\n- 使用当前带宽下载插件\r\n- 将带宽加倍(下载插件数量随之加倍)\r\n\r\n请返回小扣完成下载 `n` 个插件最少需要多少分钟。\r\n\r\n注意:实际的下载的插件数量可以超过 `n` 个\r\n\r\n\r\n**示例 1:**\r\n>输入:`n = 2`\r\n>\r\n>输出:`2`\r\n>\r\n>解释:\r\n> 以下两个方案,都能实现 2 分钟内下载 2 个插件\r\n>- 方案一:第一分钟带宽加倍,带宽可每分钟下载 2 个插件;第二分钟下载 2 个插件\r\n>- 方案二:第一分钟下载 1 个插件,第二分钟下载 1 个插件\r\n\r\n**示例 2:**\r\n>输入:`n = 4`\r\n>\r\n>输出:`3`\r\n>\r\n>解释:\r\n> 最少需要 3 分钟可完成 4 个插件的下载,以下是其中一种方案:\r\n> 第一分钟带宽加倍,带宽可每分钟下载 2 个插件;\r\n> 第二分钟下载 2 个插件;\r\n> 第三分钟下载 2 个插件。\r\n\r\n\r\n\r\n**提示:**\r\n- `1 <= n <= 10^5`\r\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 23,
|
||||
"likes": 24,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"13.3K\", \"totalAcceptedRaw\": 7250, \"totalSubmissionRaw\": 13287, \"acRate\": \"54.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.9K\", \"totalSubmission\": \"14.5K\", \"totalAcceptedRaw\": 7906, \"totalSubmissionRaw\": 14477, \"acRate\": \"54.6%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "「力扣挑战赛」中有一个由 `N` 个关卡组成的**环形**闯关游戏,关卡编号为 `0`~`N-1`,编号 `0` 的关卡和编号 `N-1` 的关卡相邻。每个关卡均有积分要求,`challenge[i]` 表示挑战编号 `i` 的关卡最少需要拥有的积分。\n{:width=\"240px\"}\n\n\n小扣想要挑战关卡,闯关的具体规则如下:\n\n- 初始小扣可以指定其中一个关卡为「开启」状态,其余关卡将处于「未开启」状态。\n- 小扣可以挑战处于「开启」状态且**满足最少积分要求**的关卡,若小扣挑战该关卡前积分为 `score`,挑战结束后,积分将增长为 `score|challenge[i]`(即位运算中的 `\"OR\"` 运算)\n- 在挑战某个关卡后,该关卡两侧相邻的关卡将会开启(若之前未开启)\n\n请帮助小扣进行计算,初始最少需要多少积分,可以挑战 **环形闯关游戏** 的所有关卡。\n\n**示例1:**\n\n> 输入:`challenge = [5,4,6,2,7]`\n>\n> 输出:`4`\n> \n> 解释: 初始选择编号 3 的关卡开启,积分为 4\n>挑战编号 3 的关卡,积分变为 $4 | 2 = 6$,开启 2、4 处的关卡\n>挑战编号 2 的关卡,积分变为 $6 | 6 = 6$,开启 1 处的关卡\n>挑战编号 1 的关卡,积分变为 $6 | 4 = 6$,开启 0 处的关卡\n>挑战编号 0 的关卡,积分变为 $6 | 5 = 7$\n>挑战编号 4 的关卡,顺利完成全部的关卡\n\n\n**示例2:**\n\n> 输入:`challenge = [12,7,11,3,9]`\n>\n> 输出:`8`\n>\n> 解释: 初始选择编号 3 的关卡开启,积分为 8\n>挑战编号 3 的关卡,积分变为 $8 | 3 = 11$,开启 2、4 处的关卡\n>挑战编号 2 的关卡,积分变为 $11 | 11 = 11$,开启 1 处的关卡\n>挑战编号 4 的关卡,积分变为 $11 | 9 = 11$,开启 0 处的关卡\n>挑战编号 1 的关卡,积分变为 $11 | 7 = 15$\n>挑战编号 0 的关卡,顺利完成全部的关卡\n\n**示例3:**\n\n> 输入:`challenge = [1,1,1]`\n>\n> 输出:`1`\n\n**提示:** \n- `1 <= challenge.length <= 5*10^4`\n- `1 <= challenge[i] <= 10^18`",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 5,
|
||||
"likes": 6,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"474\", \"totalSubmission\": \"1.7K\", \"totalAcceptedRaw\": 474, \"totalSubmissionRaw\": 1732, \"acRate\": \"27.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"555\", \"totalSubmission\": \"1.9K\", \"totalAcceptedRaw\": 555, \"totalSubmissionRaw\": 1921, \"acRate\": \"28.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个单链表 <code>L</code><em> </em>的头节点 <code>head</code> ,单链表 <code>L</code> 表示为:</p>\n\n<p><code> L<sub>0 </sub>→ L<sub>1 </sub>→ … → L<sub>n-1 </sub>→ L<sub>n </sub></code><br />\n请将其重新排列后变为:</p>\n\n<p><code>L<sub>0 </sub>→ L<sub>n </sub>→ L<sub>1 </sub>→ L<sub>n-1 </sub>→ L<sub>2 </sub>→ L<sub>n-2 </sub>→ …</code></p>\n\n<p>不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。</p>\n\n<p> </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> </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 <= node.val <= 1000</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 143 题相同:<a href=\"https://leetcode-cn.com/problems/reorder-list/\">https://leetcode-cn.com/problems/reorder-list/</a> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 46,
|
||||
"likes": 51,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"15.1K\", \"totalSubmission\": \"22.9K\", \"totalAcceptedRaw\": 15114, \"totalSubmissionRaw\": 22871, \"acRate\": \"66.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"17.7K\", \"totalSubmission\": \"26.7K\", \"totalAcceptedRaw\": 17661, \"totalSubmissionRaw\": 26668, \"acRate\": \"66.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个二叉树的 <strong>根节点</strong> <code>root</code>,请找出该二叉树的 <strong>最底层 最左边 </strong>节点的值。</p>\n\n<p>假设二叉树中至少有一个节点。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2020/12/14/tree1.jpg\" style=\"width: 182px; \" /></p>\n\n<pre>\n<strong>输入: </strong>root = [2,1,3]\n<strong>输出: </strong>1\n</pre>\n\n<p><strong>示例 2: </strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2020/12/14/tree2.jpg\" style=\"width: 242px; \" /><strong> </strong></p>\n\n<pre>\n<strong>输入: </strong>[1,2,3,4,null,5,6,null,null,7]\n<strong>输出: </strong>7\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>二叉树的节点个数的范围是 <code>[1,10<sup>4</sup>]</code></li>\n\t<li><meta charset=\"UTF-8\" /><code>-2<sup>31</sup> <= Node.val <= 2<sup>31</sup> - 1</code> </li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 513 题相同: <a href=\"https://leetcode-cn.com/problems/find-bottom-left-tree-value/\">https://leetcode-cn.com/problems/find-bottom-left-tree-value/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 16,
|
||||
"likes": 20,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"13.7K\", \"totalAcceptedRaw\": 11006, \"totalSubmissionRaw\": 13694, \"acRate\": \"80.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"13.1K\", \"totalSubmission\": \"16.3K\", \"totalAcceptedRaw\": 13060, \"totalSubmissionRaw\": 16348, \"acRate\": \"79.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定两个字符串 <code>s</code> 和 <code>t</code> 。返回 <code>s</code> 中包含 <code>t</code> 的所有字符的最短子字符串。如果 <code>s</code> 中不存在符合条件的子字符串,则返回空字符串 <code>""</code> 。</p>\n\n<p>如果 <code>s</code> 中存在多个符合条件的子字符串,返回任意一个。</p>\n\n<p> </p>\n\n<p><strong>注意: </strong>对于 <code>t</code> 中重复字符,我们寻找的子字符串中该字符数量必须不少于 <code>t</code> 中该字符数量。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "ADOBECODEBANC", t = "ABC"\n<strong>输出:</strong>"BANC" \n<strong>解释:</strong>最短子字符串 "BANC" 包含了字符串 t 的所有字符 'A'、'B'、'C'</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "a", t = "a"\n<strong>输出:</strong>"a"\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "a", t = "aa"\n<strong>输出:</strong>""\n<strong>解释:</strong>t 中两个字符 'a' 均应包含在 s 的子串中,因此没有符合条件的子字符串,返回空字符串。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length, t.length <= 10<sup>5</sup></code></li>\n\t<li><code>s</code> 和 <code>t</code> 由英文字母组成</li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>你能设计一个在 <code>o(n)</code> 时间内解决此问题的算法吗?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 76 题相似(本题答案不唯一):<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": 33,
|
||||
"likes": 39,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"11K\", \"totalSubmission\": \"21.9K\", \"totalAcceptedRaw\": 10963, \"totalSubmissionRaw\": 21858, \"acRate\": \"50.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.9K\", \"totalSubmission\": \"25.7K\", \"totalAcceptedRaw\": 12949, \"totalSubmissionRaw\": 25726, \"acRate\": \"50.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个字符串 <code>s</code> ,请将 <code>s</code> 分割成一些子串,使每个子串都是 <strong>回文串</strong> ,返回 s 所有可能的分割方案。</p>\n\n<p><meta charset=\"UTF-8\" /><strong>回文串</strong> 是正着读和反着读都一样的字符串。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>s =<strong> </strong>"google"\n<strong>输出:</strong>[["g","o","o","g","l","e"],["g","oo","g","l","e"],["goog","l","e"]]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "aab"\n<strong>输出:</strong>[["a","a","b"],["aa","b"]]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>s = "a"\n<strong>输出:</strong>[["a"]]</pre>\n\n<p> </p>\n\n<p><b>提示:</b></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 16</code></li>\n\t<li><code>s </code>仅由小写英文字母组成</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 131 题相同: <a href=\"https://leetcode-cn.com/problems/palindrome-partitioning/\">https://leetcode-cn.com/problems/palindrome-partitioning/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 20,
|
||||
"likes": 21,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -144,7 +144,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"9.6K\", \"totalAcceptedRaw\": 7161, \"totalSubmissionRaw\": 9598, \"acRate\": \"74.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.5K\", \"totalSubmission\": \"11.3K\", \"totalAcceptedRaw\": 8471, \"totalSubmissionRaw\": 11305, \"acRate\": \"74.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定两个字符串 <code>s1</code> 和 <code>s2</code>,写一个函数来判断 <code>s2</code> 是否包含 <code>s1</code><strong> </strong>的某个变位词。</p>\n\n<p>换句话说,第一个字符串的排列之一是第二个字符串的 <strong>子串</strong> 。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>s1 = "ab" s2 = "eidbaooo"\n<strong>输出: </strong>True\n<strong>解释:</strong> s2 包含 s1 的排列之一 ("ba").\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>s1= "ab" s2 = "eidboaoo"\n<strong>输出:</strong> False\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s1.length, s2.length <= 10<sup>4</sup></code></li>\n\t<li><code>s1</code> 和 <code>s2</code> 仅包含小写字母</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 567 题相同: <a href=\"https://leetcode-cn.com/problems/permutation-in-string/\">https://leetcode-cn.com/problems/permutation-in-string/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 31,
|
||||
"likes": 39,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"15.6K\", \"totalSubmission\": \"30.5K\", \"totalAcceptedRaw\": 15609, \"totalSubmissionRaw\": 30457, \"acRate\": \"51.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"18.4K\", \"totalSubmission\": \"35.9K\", \"totalAcceptedRaw\": 18440, \"totalSubmissionRaw\": 35906, \"acRate\": \"51.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个排序的整数数组 <code>nums</code> 和一个整数目标值<code> target</code> ,请在数组中找到 <code>target </code>,并返回其下标。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。</p>\n\n<p>请必须使用时间复杂度为 <code>O(log n)</code> 的算法。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [1,3,5,6], target = 5\n<strong>输出:</strong> 2\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [1,3,5,6], target = 2\n<strong>输出:</strong> 1\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [1,3,5,6], target = 7\n<strong>输出:</strong> 4\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [1,3,5,6], target = 0\n<strong>输出:</strong> 0\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong> nums = [1], target = 0\n<strong>输出:</strong> 0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>4</sup></code></li>\n\t<li><code>-10<sup>4</sup> <= nums[i] <= 10<sup>4</sup></code></li>\n\t<li><code>nums</code> 为<strong>无重复元素</strong>的<strong>升序</strong>排列数组</li>\n\t<li><code>-10<sup>4</sup> <= target <= 10<sup>4</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 35 题相同: <a href=\"https://leetcode-cn.com/problems/search-insert-position/\">https://leetcode-cn.com/problems/search-insert-position/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 13,
|
||||
"likes": 17,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.5K\", \"totalSubmission\": \"20.9K\", \"totalAcceptedRaw\": 10507, \"totalSubmissionRaw\": 20887, \"acRate\": \"50.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.5K\", \"totalSubmission\": \"24.9K\", \"totalAcceptedRaw\": 12481, \"totalSubmissionRaw\": 24897, \"acRate\": \"50.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个非空的正整数数组 <code>nums</code> ,请判断能否将这些数字分成元素和相等的两部分。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,5,11,5]\n<strong>输出:</strong>true\n<strong>解释:</strong>nums<strong> </strong>可以分割成 [1, 5, 5] 和 [11] 。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,5]\n<strong>输出:</strong>false\n<strong>解释:</strong>nums<strong> </strong>不可以分为和相等的两部分\n</pre>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" /></p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 200</code></li>\n\t<li><code>1 <= nums[i] <= 100</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 416 题相同: <a href=\"https://leetcode-cn.com/problems/partition-equal-subset-sum/\">https://leetcode-cn.com/problems/partition-equal-subset-sum/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 32,
|
||||
"likes": 36,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"16K\", \"totalAcceptedRaw\": 7969, \"totalSubmissionRaw\": 15955, \"acRate\": \"49.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9.7K\", \"totalSubmission\": \"19.4K\", \"totalAcceptedRaw\": 9747, \"totalSubmissionRaw\": 19439, \"acRate\": \"50.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一棵二叉搜索树,请 <strong>按中序遍历</strong> 将其重新排列为一棵递增顺序搜索树,使树中最左边的节点成为树的根节点,并且每个节点没有左子节点,只有一个右子节点。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/11/17/ex1.jpg\" style=\"width: 600px; height: 350px;\" /></p>\n\n<pre>\n<strong>输入:</strong>root = [5,3,6,2,4,null,8,1,null,null,null,7,9]\n<strong>输出:</strong>[1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/11/17/ex2.jpg\" style=\"width: 300px; height: 114px;\" /></p>\n\n<pre>\n<strong>输入:</strong>root = [5,1,7]\n<strong>输出:</strong>[1,null,5,null,7]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>树中节点数的取值范围是 <code>[1, 100]</code></li>\n\t<li><code>0 <= Node.val <= 1000</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 897 题相同: <a href=\"https://leetcode-cn.com/problems/increasing-order-search-tree/\">https://leetcode-cn.com/problems/increasing-order-search-tree/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 25,
|
||||
"likes": 28,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -168,7 +168,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"11.5K\", \"totalSubmission\": \"15.4K\", \"totalAcceptedRaw\": 11489, \"totalSubmissionRaw\": 15354, \"acRate\": \"74.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"13.5K\", \"totalSubmission\": \"18.1K\", \"totalAcceptedRaw\": 13524, \"totalSubmissionRaw\": 18149, \"acRate\": \"74.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>完全二叉树是每一层(除最后一层外)都是完全填充(即,节点数达到最大,第 <code>n</code> 层有 <code>2<sup>n-1</sup></code> 个节点)的,并且所有的节点都尽可能地集中在左侧。</p>\n\n<p>设计一个用完全二叉树初始化的数据结构 <code>CBTInserter</code>,它支持以下几种操作:</p>\n\n<ul>\n\t<li><code>CBTInserter(TreeNode root)</code> 使用根节点为 <code>root</code> 的给定树初始化该数据结构;</li>\n\t<li><code>CBTInserter.insert(int v)</code> 向树中插入一个新节点,节点类型为 <code>TreeNode</code>,值为 <code>v</code> 。使树保持完全二叉树的状态,<strong>并返回插入的新节点的父节点的值</strong>;</li>\n\t<li><code>CBTInserter.get_root()</code> 将返回树的根节点。</li>\n</ul>\n\n<p> </p>\n\n<ol>\n</ol>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>inputs = ["CBTInserter","insert","get_root"], inputs = [[[1]],[2],[]]\n<strong>输出:</strong>[null,1,[1,2]]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>inputs = ["CBTInserter","insert","insert","get_root"], inputs = [[[1,2,3,4,5,6]],[7],[8],[]]\n<strong>输出:</strong>[null,3,4,[1,2,3,4,5,6,7,8]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>最初给定的树是完全二叉树,且包含 <code>1</code> 到 <code>1000</code> 个节点。</li>\n\t<li>每个测试用例最多调用 <code>CBTInserter.insert</code> 操作 <code>10000</code> 次。</li>\n\t<li>给定节点或插入节点的每个值都在 <code>0</code> 到 <code>5000</code> 之间。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 919 题相同: <a href=\"https://leetcode-cn.com/problems/complete-binary-tree-inserter/\">https://leetcode-cn.com/problems/complete-binary-tree-inserter/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 20,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.8K\", \"totalSubmission\": \"12.4K\", \"totalAcceptedRaw\": 7768, \"totalSubmissionRaw\": 12419, \"acRate\": \"62.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9.4K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 9407, \"totalSubmissionRaw\": 15091, \"acRate\": \"62.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p><big><small>给定一个二维矩阵 <code>matrix</code>,</small></big>以下类型的多个请求:</p>\n\n<ul>\n\t<li><big><small>计算其子矩形范围内元素的总和,该子矩阵的左上角为 <code>(row1, col1)</code> ,右下角为 <code>(row2, col2)</code> 。</small></big></li>\n</ul>\n\n<p>实现 <code>NumMatrix</code> 类:</p>\n\n<ul>\n\t<li><code>NumMatrix(int[][] matrix)</code> 给定整数矩阵 <code>matrix</code> 进行初始化</li>\n\t<li><code>int sumRegion(int row1, int col1, int row2, int col2)</code> 返回<big><small>左上角</small></big><big><small> <code>(row1, col1)</code> 、右下角 <code>(row2, col2)</code></small></big> 的子矩阵的元素总和。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://pic.leetcode-cn.com/1626332422-wUpUHT-image.png\" style=\"width: 200px;\" /></p>\n\n<pre>\n<strong>输入:</strong> \n["NumMatrix","sumRegion","sumRegion","sumRegion"]\n[[[[3,0,1,4,2],[5,6,3,2,1],[1,2,0,1,5],[4,1,0,1,7],[1,0,3,0,5]]],[2,1,4,3],[1,1,2,2],[1,2,2,4]]\n<strong>输出:</strong> \n[null, 8, 11, 12]\n\n<strong>解释:</strong>\nNumMatrix numMatrix = new NumMatrix([[3,0,1,4,2],[5,6,3,2,1],[1,2,0,1,5],[4,1,0,1,7],[1,0,3,0,5]]]);\nnumMatrix.sumRegion(2, 1, 4, 3); // return 8 (红色矩形框的元素总和)\nnumMatrix.sumRegion(1, 1, 2, 2); // return 11 (绿色矩形框的元素总和)\nnumMatrix.sumRegion(1, 2, 2, 4); // return 12 (蓝色矩形框的元素总和)\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == matrix.length</code></li>\n\t<li><code>n == matrix[i].length</code></li>\n\t<li><code>1 <= m, n <= 200</code><meta charset=\"UTF-8\" /></li>\n\t<li><code>-10<sup>5</sup> <= matrix[i][j] <= 10<sup>5</sup></code></li>\n\t<li><code>0 <= row1 <= row2 < m</code></li>\n\t<li><code>0 <= col1 <= col2 < n</code></li>\n\t<li><meta charset=\"UTF-8\" />最多调用 <code>10<sup>4</sup></code> 次 <code>sumRegion</code> 方法</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 304 题相同: <a href=\"https://leetcode-cn.com/problems/range-sum-query-2d-immutable/\">https://leetcode-cn.com/problems/range-sum-query-2d-immutable/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 25,
|
||||
"likes": 31,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"12.5K\", \"totalSubmission\": \"18.9K\", \"totalAcceptedRaw\": 12520, \"totalSubmissionRaw\": 18896, \"acRate\": \"66.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"14.6K\", \"totalSubmission\": \"22.1K\", \"totalAcceptedRaw\": 14615, \"totalSubmissionRaw\": 22122, \"acRate\": \"66.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<div class=\"title__3Vvk\">\n<p>运用所掌握的数据结构,设计和实现一个 <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> 以正整数作为容量 <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> 如果关键字已经存在,则变更其数据值;如果关键字不存在,则插入该组「关键字-值」。当缓存容量达到上限时,它应该在写入新数据之前删除最久未使用的数据值,从而为新的数据值留出空间。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\n["LRUCache", "put", "put", "get", "put", "get", "put", "get", "get", "get"]\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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= capacity <= 3000</code></li>\n\t<li><code>0 <= key <= 10000</code></li>\n\t<li><code>0 <= value <= 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> </p>\n\n<p><strong>进阶</strong>:是否可以在 <code>O(1)</code> 时间复杂度内完成这两种操作?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 146 题相同:<a href=\"https://leetcode-cn.com/problems/lru-cache/\">https://leetcode-cn.com/problems/lru-cache/</a> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 40,
|
||||
"likes": 44,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.5K\", \"totalSubmission\": \"17.7K\", \"totalAcceptedRaw\": 9545, \"totalSubmissionRaw\": 17740, \"acRate\": \"53.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.2K\", \"totalSubmission\": \"20.8K\", \"totalAcceptedRaw\": 11205, \"totalSubmissionRaw\": 20782, \"acRate\": \"53.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一棵二叉搜索树和其中的一个节点 <code>p</code> ,找到该节点在树中的中序后继。如果节点没有中序后继,请返回 <code>null</code> 。</p>\n\n<p>节点 <code>p</code> 的后继是值比 <code>p.val</code> 大的节点中键值最小的节点,即按中序遍历的顺序节点 <code>p</code> 的下一个节点。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2019/01/23/285_example_1.PNG\" style=\"height: 117px; width: 122px;\" /></p>\n\n<pre>\n<strong>输入:</strong>root = [2,1,3], p = 1\n<strong>输出:</strong>2\n<strong>解释:</strong>这里 1 的中序后继是 2。请注意 p 和返回值都应是 TreeNode 类型。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2019/01/23/285_example_2.PNG\" style=\"height: 229px; width: 246px;\" /></p>\n\n<pre>\n<strong>输入:</strong>root = [5,3,6,2,4,null,null,1], p = 6\n<strong>输出:</strong>null\n<strong>解释:</strong>因为给出的节点没有中序后继,所以答案就返回 <code>null 了。</code>\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>树中节点的数目在范围 <code>[1, 10<sup>4</sup>]</code> 内。</li>\n\t<li><code>-10<sup>5</sup> <= Node.val <= 10<sup>5</sup></code></li>\n\t<li>树中各节点的值均保证唯一。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 285 题相同: <a href=\"https://leetcode-cn.com/problems/inorder-successor-in-bst/\">https://leetcode-cn.com/problems/inorder-successor-in-bst/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 25,
|
||||
"likes": 28,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -144,7 +144,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"11.4K\", \"totalSubmission\": \"18K\", \"totalAcceptedRaw\": 11398, \"totalSubmissionRaw\": 18030, \"acRate\": \"63.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"13.6K\", \"totalSubmission\": \"21.5K\", \"totalAcceptedRaw\": 13556, \"totalSubmissionRaw\": 21486, \"acRate\": \"63.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个由 <code>0</code> 和 <code>1</code> 组成的矩阵 <code>matrix</code> ,找出只包含 <code>1</code> 的最大矩形,并返回其面积。</p>\n\n<p><strong>注意:</strong>此题 <code>matrix</code> 输入格式为一维 <code>01</code> 字符串数组。</p>\n\n<p> </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> </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 <= row, cols <= 200</code></li>\n\t<li><code>matrix[i][j]</code> 为 <code>'0'</code> 或 <code>'1'</code></li>\n</ul>\n\n<p> </p>\n\n<p>注意:本题与主站 85 题相同(输入参数格式不同): <a href=\"https://leetcode-cn.com/problems/maximal-rectangle/\">https://leetcode-cn.com/problems/maximal-rectangle/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 30,
|
||||
"likes": 37,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -168,7 +168,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 5990, \"totalSubmissionRaw\": 10352, \"acRate\": \"57.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.2K\", \"totalSubmission\": \"12.5K\", \"totalAcceptedRaw\": 7243, \"totalSubmissionRaw\": 12471, \"acRate\": \"58.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2K\", \"totalSubmission\": \"2.8K\", \"totalAcceptedRaw\": 2020, \"totalSubmissionRaw\": 2777, \"acRate\": \"72.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"2K\", \"totalSubmission\": \"2.8K\", \"totalAcceptedRaw\": 2022, \"totalSubmissionRaw\": 2780, \"acRate\": \"72.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>一个专业的小偷,计划偷窃一个环形街道上沿街的房屋,每间房内都藏有一定的现金。这个地方所有的房屋都 <strong>围成一圈</strong> ,这意味着第一个房屋和最后一个房屋是紧挨着的。同时,相邻的房屋装有相互连通的防盗系统,<strong>如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警</strong> 。</p>\n\n<p>给定一个代表每个房屋存放金额的非负整数数组 <code>nums</code> ,请计算 <strong>在不触动警报装置的情况下</strong> ,今晚能够偷窃到的最高金额。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [2,3,2]\n<strong>输出:</strong>3\n<strong>解释:</strong>你不能先偷窃 1 号房屋(金额 = 2),然后偷窃 3 号房屋(金额 = 2), 因为他们是相邻的。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3,1]\n<strong>输出:</strong>4\n<strong>解释:</strong>你可以先偷窃 1 号房屋(金额 = 1),然后偷窃 3 号房屋(金额 = 3)。\n 偷窃到的最高金额 = 1 + 3 = 4 。</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0]\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 100</code></li>\n\t<li><code>0 <= nums[i] <= 1000</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 213 题相同: <a href=\"https://leetcode-cn.com/problems/house-robber-ii/\">https://leetcode-cn.com/problems/house-robber-ii/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 12,
|
||||
"likes": 16,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6K\", \"totalSubmission\": \"12.2K\", \"totalAcceptedRaw\": 5985, \"totalSubmissionRaw\": 12169, \"acRate\": \"49.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.1K\", \"totalSubmission\": \"14.5K\", \"totalAcceptedRaw\": 7122, \"totalSubmissionRaw\": 14539, \"acRate\": \"49.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>如果序列 <code>X_1, X_2, ..., X_n</code> 满足下列条件,就说它是 <em>斐波那契式 </em>的:</p>\n\n<ul>\n\t<li><code>n >= 3</code></li>\n\t<li>对于所有 <code>i + 2 <= n</code>,都有 <code>X_i + X_{i+1} = X_{i+2}</code></li>\n</ul>\n\n<p>给定一个<strong>严格递增</strong>的正整数数组形成序列 <code>arr</code> ,找到 <code>arr</code> 中最长的斐波那契式的子序列的长度。如果一个不存在,返回 0 。</p>\n\n<p><em>(回想一下,子序列是从原序列 <code>arr</code> 中派生出来的,它从 <code>arr</code> 中删掉任意数量的元素(也可以不删),而不改变其余元素的顺序。例如, <code>[3, 5, 8]</code> 是 <code>[3, 4, 5, 6, 7, 8]</code> 的一个子序列)</em></p>\n\n<p> </p>\n\n<ul>\n</ul>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>arr =<strong> </strong>[1,2,3,4,5,6,7,8]\n<strong>输出: </strong>5\n<strong>解释: </strong>最长的斐波那契式子序列为 [1,2,3,5,8] 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>arr =<strong> </strong>[1,3,7,11,12,14,18]\n<strong>输出: </strong>3\n<strong>解释</strong>: 最长的斐波那契式子序列有 [1,11,12]、[3,11,14] 以及 [7,11,18] 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>3 <= arr.length <= 1000</code></li>\n\t<li>\n\t<p><code>1 <= arr[i] < arr[i + 1] <= 10^9</code></p>\n\t</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 873 题相同: <a href=\"https://leetcode-cn.com/problems/length-of-longest-fibonacci-subsequence/\">https://leetcode-cn.com/problems/length-of-longest-fibonacci-subsequence/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 26,
|
||||
"likes": 31,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.1K\", \"totalSubmission\": \"10.4K\", \"totalAcceptedRaw\": 6115, \"totalSubmissionRaw\": 10440, \"acRate\": \"58.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.3K\", \"totalSubmission\": \"12.5K\", \"totalAcceptedRaw\": 7290, \"totalSubmissionRaw\": 12476, \"acRate\": \"58.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>现在总共有 <code>numCourses</code> 门课需要选,记为 <code>0</code> 到 <code>numCourses-1</code>。</p>\n\n<p>给定一个数组 <code>prerequisites</code> ,它的每一个元素 <code>prerequisites[i]</code> 表示两门课程之间的先修顺序。 例如 <code>prerequisites[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> 表示想要学习课程 <code>a<sub>i</sub></code> ,需要先完成课程 <code>b<sub>i</sub></code> 。</p>\n\n<p>请根据给出的总课程数 <code>numCourses</code> 和表示先修顺序的 <code>prerequisites</code> 得出一个可行的修课序列。</p>\n\n<p>可能会有多个正确的顺序,只要任意返回一种就可以了。如果不可能完成所有课程,返回一个空数组。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> numCourses = 2, prerequisites = [[1,0]] \n<strong>输出: </strong><code>[0,1]</code>\n<strong>解释:</strong> 总共有 2 门课程。要学习课程 1,你需要先完成课程 0。因此,正确的课程顺序为 <code>[0,1] 。</code></pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> numCourses = 4, prerequisites = [[1,0],[2,0],[3,1],[3,2]]\n<strong>输出: </strong><code>[0,1,2,3] or [0,2,1,3]</code>\n<strong>解释:</strong> 总共有 4 门课程。要学习课程 3,你应该先完成课程 1 和课程 2。并且课程 1 和课程 2 都应该排在课程 0 之后。\n 因此,一个正确的课程顺序是 <code>[0,1,2,3]</code> 。另一个正确的排序是 <code>[0,2,1,3]</code> 。\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong> numCourses = 1, prerequisites = [] \n<strong>输出: </strong><code>[0]</code>\n<strong>解释:</strong> 总共 1 门课,直接修第一门课就可。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= numCourses <= 2000</code></li>\n\t<li><code>0 <= prerequisites.length <= numCourses * (numCourses - 1)</code></li>\n\t<li><code>prerequisites[i].length == 2</code></li>\n\t<li><code>0 <= ai, bi < numCourses</code></li>\n\t<li><code>ai != bi</code></li>\n\t<li><code>prerequisites</code> 中不存在重复元素</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 210 题相同:<a href=\"https://leetcode-cn.com/problems/course-schedule-ii/\">https://leetcode-cn.com/problems/course-schedule-ii/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 12,
|
||||
"likes": 14,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.4K\", \"totalSubmission\": \"7.6K\", \"totalAcceptedRaw\": 4388, \"totalSubmissionRaw\": 7620, \"acRate\": \"57.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.2K\", \"totalSubmission\": \"9.1K\", \"totalAcceptedRaw\": 5224, \"totalSubmissionRaw\": 9092, \"acRate\": \"57.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p><strong><a href=\"https://baike.baidu.com/item/字典树/9825209?fr=aladdin\" target=\"_blank\">Trie</a></strong>(发音类似 "try")或者说 <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> 如果之前已经插入的字符串 <code>word</code> 的前缀之一为 <code>prefix</code> ,返回 <code>true</code> ;否则,返回 <code>false</code> 。</li>\n</ul>\n\n<p> </p>\n\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\ninputs = ["Trie", "insert", "search", "search", "startsWith", "insert", "search"]\ninputs = [[], ["apple"], ["apple"], ["app"], ["app"], ["app"], ["app"]]\n<strong>输出</strong>\n[null, null, true, false, true, null, true]\n\n<strong>解释</strong>\nTrie trie = new Trie();\ntrie.insert("apple");\ntrie.search("apple"); // 返回 True\ntrie.search("app"); // 返回 False\ntrie.startsWith("app"); // 返回 True\ntrie.insert("app");\ntrie.search("app"); // 返回 True\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= word.length, prefix.length <= 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> </p>\n\n<p> </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> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 12,
|
||||
"likes": 16,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"7.4K\", \"totalSubmission\": \"9.6K\", \"totalAcceptedRaw\": 7418, \"totalSubmissionRaw\": 9639, \"acRate\": \"77.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"9K\", \"totalSubmission\": \"11.7K\", \"totalAcceptedRaw\": 8965, \"totalSubmissionRaw\": 11685, \"acRate\": \"76.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -9,10 +9,10 @@
|
||||
"titleSlug": "QTMn0o",
|
||||
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>\n",
|
||||
"translatedTitle": "和为 k 的子数组",
|
||||
"translatedContent": "<p>给定一个整数数组和一个整数 <code>k</code><strong> ,</strong>请找到该数组中和为 <code>k</code><strong> </strong>的连续子数组的个数。</p>\n\n<p> </p>\n\n<p><strong>示例 1 :</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,1,1], k = 2\n<strong>输出:</strong> 2\n<strong>解释:</strong> 此题 [1,1] 与 [1,1] 为两种不同的情况\n</pre>\n\n<p><strong>示例 2 :</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3], k = 3\n<strong>输出:</strong> 2\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>-1000 <= nums[i] <= 1000</code></li>\n\t<li>\n\t<p><code>-10<sup>7</sup> <= k <= 10<sup>7</sup></code></p>\n\t</li>\n</ul>\n\n<p> </p>\n\n<p>注意:本题与主站 560 题相同: <a href=\"https://leetcode-cn.com/problems/subarray-sum-equals-k/\">https://leetcode-cn.com/problems/subarray-sum-equals-k/</a></p>\n",
|
||||
"translatedContent": "<p>给定一个整数数组和一个整数 <code>k</code><strong> ,</strong>请找到该数组中和为 <code>k</code><strong> </strong>的连续子数组的个数。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,1,1], k = 2\n<strong>输出:</strong> 2\n<strong>解释:</strong> 此题 [1,1] 与 [1,1] 为两种不同的情况\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3], k = 3\n<strong>输出:</strong> 2\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 2 * 10<sup>4</sup></code></li>\n\t<li><code>-1000 <= nums[i] <= 1000</code></li>\n\t<li>\n\t<p><code>-10<sup>7</sup> <= k <= 10<sup>7</sup></code></p>\n\t</li>\n</ul>\n\n<p> </p>\n\n<p>注意:本题与主站 560 题相同: <a href=\"https://leetcode-cn.com/problems/subarray-sum-equals-k/\">https://leetcode-cn.com/problems/subarray-sum-equals-k/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 51,
|
||||
"likes": 61,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"19.5K\", \"totalSubmission\": \"44.4K\", \"totalAcceptedRaw\": 19538, \"totalSubmissionRaw\": 44359, \"acRate\": \"44.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"22.8K\", \"totalSubmission\": \"52.5K\", \"totalAcceptedRaw\": 22842, \"totalSubmissionRaw\": 52521, \"acRate\": \"43.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
@ -185,7 +185,7 @@
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"exampleTestcases": "",
|
||||
"exampleTestcases": "[1,1,1]\n2\n[1,2,3]\n3",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>多级双向链表中,除了指向下一个节点和前一个节点指针之外,它还有一个子链表指针,可能指向单独的双向链表。这些子列表也可能会有一个或多个自己的子项,依此类推,生成多级数据结构,如下面的示例所示。</p>\n\n<p>给定位于列表第一级的头节点,请扁平化列表,即将这样的多级双向链表展平成普通的双向链表,使所有结点出现在单级双链表中。</p>\n\n<p> </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> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>节点数目不超过 <code>1000</code></li>\n\t<li><code>1 <= Node.val <= 10^5</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 430 题相同: <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": 26,
|
||||
"likes": 30,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -126,7 +126,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.2K\", \"totalSubmission\": \"15.1K\", \"totalAcceptedRaw\": 9227, \"totalSubmissionRaw\": 15100, \"acRate\": \"61.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.9K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 10914, \"totalSubmissionRaw\": 17919, \"acRate\": \"60.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个非空字符串 <code>s</code>,请判断如果 <strong>最多 </strong>从字符串中删除一个字符能否得到一个回文字符串。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> s = "aba"\n<strong>输出:</strong> true\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> s = "abca"\n<strong>输出:</strong> true\n<strong>解释:</strong> 可以删除 "c" 字符 或者 "b" 字符\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong> s = "abc"\n<strong>输出:</strong> false</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 10<sup>5</sup></code></li>\n\t<li><code>s</code> 由小写英文字母组成</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 680 题相同: <a href=\"https://leetcode-cn.com/problems/valid-palindrome-ii/\">https://leetcode-cn.com/problems/valid-palindrome-ii/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 27,
|
||||
"likes": 30,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"14.4K\", \"totalSubmission\": \"31.5K\", \"totalAcceptedRaw\": 14430, \"totalSubmissionRaw\": 31471, \"acRate\": \"45.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"16.8K\", \"totalSubmission\": \"36.7K\", \"totalAcceptedRaw\": 16795, \"totalSubmissionRaw\": 36679, \"acRate\": \"45.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个链表,删除链表的倒数第 <code>n</code><em> </em>个结点,并且返回链表的头结点。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg\" style=\"width: 542px; height: 222px;\" /></p>\n\n<pre>\n<strong>输入:</strong>head = [1,2,3,4,5], n = 2\n<strong>输出:</strong>[1,2,3,5]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>head = [1], n = 1\n<strong>输出:</strong>[]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>head = [1,2], n = 1\n<strong>输出:</strong>[1]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>链表中结点的数目为 <code>sz</code></li>\n\t<li><code>1 <= sz <= 30</code></li>\n\t<li><code>0 <= Node.val <= 100</code></li>\n\t<li><code>1 <= n <= sz</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>能尝试使用一趟扫描实现吗?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 19 题相同: <a href=\"https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/\">https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 32,
|
||||
"likes": 38,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"18.9K\", \"totalSubmission\": \"35.9K\", \"totalAcceptedRaw\": 18885, \"totalSubmissionRaw\": 35940, \"acRate\": \"52.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"22.1K\", \"totalSubmission\": \"42K\", \"totalAcceptedRaw\": 22091, \"totalSubmissionRaw\": 41994, \"acRate\": \"52.6%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "某乐团的演出场地可视作 `num * num` 的二维矩阵 `grid`(左上角坐标为 `[0,0]`),每个位置站有一位成员。乐团共有 `9` 种乐器,乐器编号为 `1~9`,每位成员持有 `1` 个乐器。\n\n为保证声乐混合效果,成员站位规则为:自 `grid` 左上角开始顺时针螺旋形向内循环以 `1,2,...,9` 循环重复排列。例如当 num = `5` 时,站位如图所示\n\n\n\n\n请返回位于场地坐标 [`Xpos`,`Ypos`] 的成员所持乐器编号。\n\n**示例 1:**\n>输入:`num = 3, Xpos = 0, Ypos = 2`\n>\n>输出:`3`\n>\n>解释:\n\n\n\n**示例 2:**\n>输入:`num = 4, Xpos = 1, Ypos = 2`\n>\n>输出:`5`\n>\n>解释:\n\n\n\n**提示:**\n- `1 <= num <= 10^9`\n- `0 <= Xpos, Ypos < num`",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 58,
|
||||
"likes": 62,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -125,7 +125,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.6K\", \"totalSubmission\": \"32.9K\", \"totalAcceptedRaw\": 6647, \"totalSubmissionRaw\": 32895, \"acRate\": \"20.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7K\", \"totalSubmission\": \"33.9K\", \"totalAcceptedRaw\": 7022, \"totalSubmissionRaw\": 33910, \"acRate\": \"20.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>以数组 <code>intervals</code> 表示若干个区间的集合,其中单个区间为 <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> 。请你合并所有重叠的区间,并返回一个不重叠的区间数组,该数组需恰好覆盖输入中的所有区间。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>intervals = [[1,3],[2,6],[8,10],[15,18]]\n<strong>输出:</strong>[[1,6],[8,10],[15,18]]\n<strong>解释:</strong>区间 [1,3] 和 [2,6] 重叠, 将它们合并为 [1,6].\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>intervals = [[1,4],[4,5]]\n<strong>输出:</strong>[[1,5]]\n<strong>解释:</strong>区间 [1,4] 和 [4,5] 可被视为重叠区间。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= intervals.length <= 10<sup>4</sup></code></li>\n\t<li><code>intervals[i].length == 2</code></li>\n\t<li><code>0 <= start<sub>i</sub> <= end<sub>i</sub> <= 10<sup>4</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 56 题相同: <a href=\"https://leetcode-cn.com/problems/merge-intervals/\">https://leetcode-cn.com/problems/merge-intervals/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 21,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.8K\", \"totalSubmission\": \"15.3K\", \"totalAcceptedRaw\": 8750, \"totalSubmissionRaw\": 15267, \"acRate\": \"57.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"18.1K\", \"totalAcceptedRaw\": 10359, \"totalSubmissionRaw\": 18074, \"acRate\": \"57.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个整数数组 <code>nums</code> ,数组中的元素 <strong>互不相同</strong> 。返回该数组所有可能的子集(幂集)。</p>\n\n<p>解集 <strong>不能</strong> 包含重复的子集。你可以按 <strong>任意顺序</strong> 返回解集。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1,2,3]\n<strong>输出:</strong>[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0]\n<strong>输出:</strong>[[],[0]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10</code></li>\n\t<li><code>-10 <= nums[i] <= 10</code></li>\n\t<li><code>nums</code> 中的所有元素 <strong>互不相同</strong></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 78 题相同: <a href=\"https://leetcode-cn.com/problems/subsets/\">https://leetcode-cn.com/problems/subsets/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 24,
|
||||
"likes": 26,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"12.1K\", \"totalAcceptedRaw\": 10378, \"totalSubmissionRaw\": 12130, \"acRate\": \"85.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.3K\", \"totalSubmission\": \"14.4K\", \"totalAcceptedRaw\": 12329, \"totalSubmissionRaw\": 14355, \"acRate\": \"85.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定单链表的头节点 <code>head</code> ,请反转链表,并返回反转后的链表的头节点。</p>\n\n<div class=\"original__bRMd\">\n<div>\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>链表中节点的数目范围是 <code>[0, 5000]</code></li>\n\t<li><code>-5000 <= Node.val <= 5000</code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>链表可以选用迭代或递归方式完成反转。你能否用两种方法解决这道题?</p>\n</div>\n</div>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 206 题相同: <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": 54,
|
||||
"likes": 60,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"38.2K\", \"totalSubmission\": \"50.7K\", \"totalAcceptedRaw\": 38195, \"totalSubmissionRaw\": 50749, \"acRate\": \"75.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"43.7K\", \"totalSubmission\": \"57.9K\", \"totalAcceptedRaw\": 43662, \"totalSubmissionRaw\": 57851, \"acRate\": \"75.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>设计一个使用单词列表进行初始化的数据结构,单词列表中的单词 <strong>互不相同</strong> 。 如果给出一个单词,请判定能否只将这个单词中<strong>一个</strong>字母换成另一个字母,使得所形成的新单词存在于已构建的神奇字典中。</p>\n\n<p>实现 <code>MagicDictionary</code> 类:</p>\n\n<ul>\n\t<li><code>MagicDictionary()</code> 初始化对象</li>\n\t<li><code>void buildDict(String[] dictionary)</code> 使用字符串数组 <code>dictionary</code> 设定该数据结构,<code>dictionary</code> 中的字符串互不相同</li>\n\t<li><code>bool search(String searchWord)</code> 给定一个字符串 <code>searchWord</code> ,判定能否只将字符串中<strong> 一个 </strong>字母换成另一个字母,使得所形成的新字符串能够与字典中的任一字符串匹配。如果可以,返回 <code>true</code> ;否则,返回 <code>false</code> 。</li>\n</ul>\n\n<p> </p>\n\n<div class=\"top-view__1vxA\">\n<div class=\"original__bRMd\">\n<div>\n<p><strong>示例:</strong></p>\n\n<pre>\n<strong>输入</strong>\ninputs = ["MagicDictionary", "buildDict", "search", "search", "search", "search"]\ninputs = [[], [["hello", "leetcode"]], ["hello"], ["hhllo"], ["hell"], ["leetcoded"]]\n<strong>输出</strong>\n[null, null, false, true, false, false]\n\n<strong>解释</strong>\nMagicDictionary magicDictionary = new MagicDictionary();\nmagicDictionary.buildDict(["hello", "leetcode"]);\nmagicDictionary.search("hello"); // 返回 False\nmagicDictionary.search("hhllo"); // 将第二个 'h' 替换为 'e' 可以匹配 "hello" ,所以返回 True\nmagicDictionary.search("hell"); // 返回 False\nmagicDictionary.search("leetcoded"); // 返回 False\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= dictionary.length <= 100</code></li>\n\t<li><code>1 <= dictionary[i].length <= 100</code></li>\n\t<li><code>dictionary[i]</code> 仅由小写英文字母组成</li>\n\t<li><code>dictionary</code> 中的所有字符串 <strong>互不相同</strong></li>\n\t<li><code>1 <= searchWord.length <= 100</code></li>\n\t<li><code>searchWord</code> 仅由小写英文字母组成</li>\n\t<li><code>buildDict</code> 仅在 <code>search</code> 之前调用一次</li>\n\t<li>最多调用 <code>100</code> 次 <code>search</code></li>\n</ul>\n</div>\n</div>\n</div>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 676 题相同: <a href=\"https://leetcode-cn.com/problems/implement-magic-dictionary/\">https://leetcode-cn.com/problems/implement-magic-dictionary/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 19,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.2K\", \"totalSubmission\": \"8.4K\", \"totalAcceptedRaw\": 5168, \"totalSubmissionRaw\": 8408, \"acRate\": \"61.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"6.3K\", \"totalSubmission\": \"10.3K\", \"totalAcceptedRaw\": 6322, \"totalSubmissionRaw\": 10316, \"acRate\": \"61.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "小扣在秋日市集购买了一个古董键盘。由于古董键盘年久失修,键盘上只有 26 个字母 **a~z** 可以按下,且每个字母最多仅能被按 `k` 次。\n\n小扣随机按了 `n` 次按键,请返回小扣总共有可能按出多少种内容。由于数字较大,最终答案需要对 1000000007 (1e9 + 7) 取模。\n\n\n**示例 1:**\n>输入:`k = 1, n = 1`\n> \n>输出:`26`\n> \n>解释:由于只能按一次按键,所有可能的字符串为 \"a\", \"b\", ... \"z\" \n\n**示例 2:**\n>输入:`k = 1, n = 2`\n> \n>输出:`650`\n> \n>解释:由于只能按两次按键,且每个键最多只能按一次,所有可能的字符串(按字典序排序)为 \"ab\", \"ac\", ... \"zy\" \n\n**提示:**\n- `1 <= k <= 5`\n- `1 <= n <= 26*k`\n \n\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 28,
|
||||
"likes": 29,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.4K\", \"totalSubmission\": \"3.9K\", \"totalAcceptedRaw\": 1377, \"totalSubmissionRaw\": 3915, \"acRate\": \"35.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.5K\", \"totalSubmission\": \"4K\", \"totalAcceptedRaw\": 1452, \"totalSubmissionRaw\": 4035, \"acRate\": \"36.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>在英语中,有一个叫做 <code>词根(root)</code> 的概念,它可以跟着其他一些词组成另一个较长的单词——我们称这个词为 <code>继承词(successor)</code>。例如,词根<code>an</code>,跟随着单词 <code>other</code>(其他),可以形成新的单词 <code>another</code>(另一个)。</p>\n\n<p>现在,给定一个由许多词根组成的词典和一个句子,需要将句子中的所有<code>继承词</code>用<code>词根</code>替换掉。如果<code>继承词</code>有许多可以形成它的<code>词根</code>,则用最短的词根替换它。</p>\n\n<p>需要输出替换之后的句子。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["cat","bat","rat"], sentence = "the cattle was rattled by the battery"\n<strong>输出:</strong>"the cat was rat by the bat"\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["a","b","c"], sentence = "aadsfasf absbs bbab cadsfafs"\n<strong>输出:</strong>"a a b c"\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["a", "aa", "aaa", "aaaa"], sentence = "a aa a aaaa aaa aaa aaa aaaaaa bbb baba ababa"\n<strong>输出:</strong>"a a a a a a a a bbb baba a"\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["catt","cat","bat","rat"], sentence = "the cattle was rattled by the battery"\n<strong>输出:</strong>"the cat was rat by the bat"\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>dictionary = ["ac","ab"], sentence = "it is abnormal that this solution is accepted"\n<strong>输出:</strong>"it is ab that this solution is ac"\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= dictionary.length <= 1000</code></li>\n\t<li><code>1 <= dictionary[i].length <= 100</code></li>\n\t<li><code>dictionary[i]</code> 仅由小写字母组成。</li>\n\t<li><code>1 <= sentence.length <= 10^6</code></li>\n\t<li><code>sentence</code> 仅由小写字母和空格组成。</li>\n\t<li><code>sentence</code> 中单词的总量在范围 <code>[1, 1000]</code> 内。</li>\n\t<li><code>sentence</code> 中每个单词的长度在范围 <code>[1, 1000]</code> 内。</li>\n\t<li><code>sentence</code> 中单词之间由一个空格隔开。</li>\n\t<li><code>sentence</code> 没有前导或尾随空格。</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 648 题相同: <a href=\"https://leetcode-cn.com/problems/replace-words/\">https://leetcode-cn.com/problems/replace-words/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 20,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"8.7K\", \"totalAcceptedRaw\": 6233, \"totalSubmissionRaw\": 8671, \"acRate\": \"71.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.5K\", \"totalSubmission\": \"10.6K\", \"totalAcceptedRaw\": 7545, \"totalSubmissionRaw\": 10622, \"acRate\": \"71.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "小扣出去秋游,途中收集了一些红叶和黄叶,他利用这些叶子初步整理了一份秋叶收藏集 `leaves`, 字符串 `leaves` 仅包含小写字符 `r` 和 `y`, 其中字符 `r` 表示一片红叶,字符 `y` 表示一片黄叶。\r\n出于美观整齐的考虑,小扣想要将收藏集中树叶的排列调整成「红、黄、红」三部分。每部分树叶数量可以不相等,但均需大于等于 1。每次调整操作,小扣可以将一片红叶替换成黄叶或者将一片黄叶替换成红叶。请问小扣最少需要多少次调整操作才能将秋叶收藏集调整完毕。\r\n\r\n**示例 1:**\r\n>输入:`leaves = \"rrryyyrryyyrr\"`\r\n>\r\n>输出:`2`\r\n>\r\n>解释:调整两次,将中间的两片红叶替换成黄叶,得到 \"rrryyyyyyyyrr\"\r\n\r\n**示例 2:**\r\n>输入:`leaves = \"ryr\"`\r\n>\r\n>输出:`0`\r\n>\r\n>解释:已符合要求,不需要额外操作\r\n\r\n**提示:**\r\n- `3 <= leaves.length <= 10^5`\r\n- `leaves` 中只包含字符 `'r'` 和字符 `'y'`",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 214,
|
||||
"likes": 216,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"20.5K\", \"totalSubmission\": \"39.5K\", \"totalAcceptedRaw\": 20458, \"totalSubmissionRaw\": 39505, \"acRate\": \"51.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"20.6K\", \"totalSubmission\": \"39.8K\", \"totalAcceptedRaw\": 20615, \"totalSubmissionRaw\": 39763, \"acRate\": \"51.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "麻将的游戏规则中,共有两种方式凑成「一组牌」:\n- 顺子:三张牌面数字连续的麻将,例如 [4,5,6]\n- 刻子:三张牌面数字相同的麻将,例如 [10,10,10]\n\n给定若干数字作为麻将牌的数值(记作一维数组 `tiles`),请返回所给 `tiles` 最多可组成的牌组数。\n\n注意:凑成牌组时,每张牌仅能使用一次。\n\n**示例 1:**\n>输入:`tiles = [2,2,2,3,4]`\n>\n>输出:`1`\n>\n>解释:最多可以组合出 [2,2,2] 或者 [2,3,4] 其中一组牌。\n\n**示例 2:**\n>输入:`tiles = [2,2,2,3,4,1,3]`\n>\n>输出:`2`\n>\n>解释:最多可以组合出 [1,2,3] 与 [2,3,4] 两组牌。\n\n**提示:**\n- `1 <= tiles.length <= 10^5`\n- `1 <= tiles[i] <= 10^9`",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 18,
|
||||
"likes": 23,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.1K\", \"totalSubmission\": \"3.6K\", \"totalAcceptedRaw\": 1104, \"totalSubmissionRaw\": 3593, \"acRate\": \"30.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"1.2K\", \"totalSubmission\": \"3.8K\", \"totalAcceptedRaw\": 1245, \"totalSubmissionRaw\": 3840, \"acRate\": \"32.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -9,10 +9,10 @@
|
||||
"titleSlug": "VabMRr",
|
||||
"content": "<p>English description is not available for the problem. Please switch to Chinese.</p>\n",
|
||||
"translatedTitle": "字符串中的所有变位词",
|
||||
"translatedContent": "<p>给定两个字符串 <code>s</code> 和<b> </b><code>p</code>,找到 <code>s</code><strong> </strong>中所有 <code>p</code> 的 <strong>变位词 </strong>的子串,返回这些子串的起始索引。不考虑答案输出的顺序。</p>\n\n<p><strong>变位词 </strong>指字母相同,但排列不同的字符串。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>s = "cbaebabacd", p = "abc"\n<strong>输出: </strong>[0,6]\n<strong>解释:</strong>\n起始索引等于 0 的子串是 "cba", 它是 "abc" 的变位词。\n起始索引等于 6 的子串是 "bac", 它是 "abc" 的变位词。\n</pre>\n\n<p><strong> 示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>s = "abab", p = "ab"\n<strong>输出: </strong>[0,1,2]\n<strong>解释:</strong>\n起始索引等于 0 的子串是 "ab", 它是 "ab" 的变位词。\n起始索引等于 1 的子串是 "ba", 它是 "ab" 的变位词。\n起始索引等于 2 的子串是 "ab", 它是 "ab" 的变位词。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length, p.length <= 3 * 10<sup>4</sup></code></li>\n\t<li><code>s</code> 和 <code>p</code> 仅包含小写字母</li>\n</ul>\n\n<p> </p>\n\n<p>注意:本题与主站 438 题相同: <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",
|
||||
"translatedContent": "<p>给定两个字符串 <code>s</code> 和<b> </b><code>p</code>,找到 <code>s</code><strong> </strong>中所有 <code>p</code> 的 <strong>变位词 </strong>的子串,返回这些子串的起始索引。不考虑答案输出的顺序。</p>\n\n<p><strong>变位词 </strong>指字母相同,但排列不同的字符串。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>s = "cbaebabacd", p = "abc"\n<strong>输出: </strong>[0,6]\n<strong>解释:</strong>\n起始索引等于 0 的子串是 "cba", 它是 "abc" 的变位词。\n起始索引等于 6 的子串是 "bac", 它是 "abc" 的变位词。\n</pre>\n\n<p><strong> 示例 2:</strong></p>\n\n<pre>\n<strong>输入: </strong>s = "abab", p = "ab"\n<strong>输出: </strong>[0,1,2]\n<strong>解释:</strong>\n起始索引等于 0 的子串是 "ab", 它是 "ab" 的变位词。\n起始索引等于 1 的子串是 "ba", 它是 "ab" 的变位词。\n起始索引等于 2 的子串是 "ab", 它是 "ab" 的变位词。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length, p.length <= 3 * 10<sup>4</sup></code></li>\n\t<li><code>s</code> 和 <code>p</code> 仅包含小写字母</li>\n</ul>\n\n<p> </p>\n\n<p>注意:本题与主站 438 题相同: <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": 16,
|
||||
"likes": 23,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"12.3K\", \"totalSubmission\": \"19.7K\", \"totalAcceptedRaw\": 12280, \"totalSubmissionRaw\": 19708, \"acRate\": \"62.3%\"}",
|
||||
"stats": "{\"totalAccepted\": \"14.5K\", \"totalSubmission\": \"23.5K\", \"totalAcceptedRaw\": 14544, \"totalSubmissionRaw\": 23479, \"acRate\": \"61.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个不含重复数字的整数数组 <code>nums</code> ,返回其 <strong>所有可能的全排列</strong> 。可以 <strong>按任意顺序</strong> 返回答案。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</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><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,1]\n<strong>输出:</strong>[[0,1],[1,0]]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [1]\n<strong>输出:</strong>[[1]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 6</code></li>\n\t<li><code>-10 <= nums[i] <= 10</code></li>\n\t<li><code>nums</code> 中的所有整数 <strong>互不相同</strong></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 46 题相同:<a href=\"https://leetcode-cn.com/problems/permutations/\">https://leetcode-cn.com/problems/permutations/</a> </p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 19,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.1K\", \"totalSubmission\": \"11.8K\", \"totalAcceptedRaw\": 10129, \"totalSubmissionRaw\": 11783, \"acRate\": \"86.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.6K\", \"totalSubmission\": \"13.5K\", \"totalAcceptedRaw\": 11573, \"totalSubmissionRaw\": 13482, \"acRate\": \"85.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你一个整数数组 <code>nums</code> ,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次 。</strong>请你找出并返回那个只出现了一次的元素。</p>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 3 * 10<sup>4</sup></code></li>\n\t<li><code>-2<sup>31</sup> <= nums[i] <= 2<sup>31</sup> - 1</code></li>\n\t<li><code>nums</code> 中,除某个元素仅出现 <strong>一次</strong> 外,其余每个元素都恰出现 <strong>三次</strong></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 137 题相同:<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": 57,
|
||||
"likes": 67,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"26.7K\", \"totalSubmission\": \"37.6K\", \"totalAcceptedRaw\": 26678, \"totalSubmissionRaw\": 37650, \"acRate\": \"70.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"30.6K\", \"totalSubmission\": \"43.2K\", \"totalAcceptedRaw\": 30574, \"totalSubmissionRaw\": 43198, \"acRate\": \"70.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -137,7 +137,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.9K\", \"totalSubmission\": \"7.4K\", \"totalAcceptedRaw\": 4865, \"totalSubmissionRaw\": 7374, \"acRate\": \"66.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.9K\", \"totalSubmission\": \"7.4K\", \"totalAcceptedRaw\": 4866, \"totalSubmissionRaw\": 7375, \"acRate\": \"66.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个二叉树的 <strong>根节点</strong> <code>root</code>,想象自己站在它的右侧,按照从顶部到底部的顺序,返回从右侧所能看到的节点值。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2021/02/14/tree.jpg\" style=\"width: 270px; \" /></p>\n\n<pre>\n<strong>输入:</strong> [1,2,3,null,5,null,4]\n<strong>输出:</strong> [1,3,4]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> [1,null,3]\n<strong>输出:</strong> [1,3]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong> []\n<strong>输出:</strong> []\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li>二叉树的节点个数的范围是 <code>[0,100]</code></li>\n\t<li><meta charset=\"UTF-8\" /><code>-100 <= Node.val <= 100</code> </li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 199 题相同:<a href=\"https://leetcode-cn.com/problems/binary-tree-right-side-view/\">https://leetcode-cn.com/problems/binary-tree-right-side-view/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 22,
|
||||
"likes": 25,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"9.9K\", \"totalSubmission\": \"13.9K\", \"totalAcceptedRaw\": 9929, \"totalSubmissionRaw\": 13856, \"acRate\": \"71.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"11.8K\", \"totalSubmission\": \"16.5K\", \"totalAcceptedRaw\": 11803, \"totalSubmissionRaw\": 16467, \"acRate\": \"71.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个未排序的整数数组 <code>nums</code> ,找出数字连续的最长序列(不要求序列元素在原数组中连续)的长度。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [100,4,200,1,3,2]\n<strong>输出:</strong>4\n<strong>解释:</strong>最长数字连续序列是 <code>[1, 2, 3, 4]。它的长度为 4。</code></pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>nums = [0,3,7,2,5,8,4,6,0,1]\n<strong>输出:</strong>9\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= nums.length <= 10<sup>4</sup></code></li>\n\t<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>\n</ul>\n\n<p> </p>\n\n<p><strong>进阶:</strong>可以设计并实现时间复杂度为 <code>O(n)</code><em> </em>的解决方案吗?</p>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 128 题相同: <a href=\"https://leetcode-cn.com/problems/longest-consecutive-sequence/\">https://leetcode-cn.com/problems/longest-consecutive-sequence/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 24,
|
||||
"likes": 26,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8.8K\", \"totalSubmission\": \"17.9K\", \"totalAcceptedRaw\": 8819, \"totalSubmissionRaw\": 17926, \"acRate\": \"49.2%\"}",
|
||||
"stats": "{\"totalAccepted\": \"10.4K\", \"totalSubmission\": \"21.3K\", \"totalAcceptedRaw\": 10448, \"totalSubmissionRaw\": 21272, \"acRate\": \"49.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "有 `N` 位扣友参加了微软与力扣举办了「以扣会友」线下活动。主办方提供了 `2*N` 道题目,整型数组 `questions` 中每个数字对应了每道题目所涉及的知识点类型。\r\n若每位扣友选择不同的一题,请返回被选的 `N` 道题目至少包含多少种知识点类型。\r\n\r\n\r\n**示例 1:**\r\n>输入:`questions = [2,1,6,2]`\r\n>\r\n>输出:`1`\r\n>\r\n>解释:有 2 位扣友在 4 道题目中选择 2 题。\r\n> 可选择完成知识点类型为 2 的题目时,此时仅一种知识点类型\r\n> 因此至少包含 1 种知识点类型。\r\n\r\n**示例 2:**\r\n>输入:`questions = [1,5,1,3,4,5,2,5,3,3,8,6]`\r\n>\r\n>输出:`2`\r\n>\r\n>解释:有 6 位扣友在 12 道题目中选择题目,需要选择 6 题。\r\n> 选择完成知识点类型为 3、5 的题目,因此至少包含 2 种知识点类型。\r\n\r\n\r\n\r\n**提示:**\r\n- `questions.length == 2*n`\r\n- `2 <= questions.length <= 10^5`\r\n- `1 <= questions[i] <= 1000`",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 7,
|
||||
"likes": 8,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -162,7 +162,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"5.3K\", \"totalSubmission\": \"8K\", \"totalAcceptedRaw\": 5276, \"totalSubmissionRaw\": 7987, \"acRate\": \"66.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.6K\", \"totalSubmission\": \"8.5K\", \"totalAcceptedRaw\": 5633, \"totalSubmissionRaw\": 8520, \"acRate\": \"66.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个整数数组 <code>asteroids</code>,表示在同一行的小行星。</p>\n\n<p>对于数组中的每一个元素,其绝对值表示小行星的大小,正负表示小行星的移动方向(正表示向右移动,负表示向左移动)。每一颗小行星以相同的速度移动。</p>\n\n<p>找出碰撞后剩下的所有小行星。碰撞规则:两个行星相互碰撞,较小的行星会爆炸。如果两颗行星大小相同,则两颗行星都会爆炸。两颗移动方向相同的行星,永远不会发生碰撞。</p>\n\n<p> </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> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>2 <= asteroids.length <= 10<sup>4</sup></code></li>\n\t<li><code>-1000 <= asteroids[i] <= 1000</code></li>\n\t<li><code>asteroids[i] != 0</code></li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 735 题相同: <a href=\"https://leetcode-cn.com/problems/asteroid-collision/\">https://leetcode-cn.com/problems/asteroid-collision/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 21,
|
||||
"likes": 25,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"10.8K\", \"totalSubmission\": \"24.3K\", \"totalAcceptedRaw\": 10809, \"totalSubmissionRaw\": 24341, \"acRate\": \"44.4%\"}",
|
||||
"stats": "{\"totalAccepted\": \"12.8K\", \"totalSubmission\": \"28.9K\", \"totalAcceptedRaw\": 12783, \"totalSubmissionRaw\": 28944, \"acRate\": \"44.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给定一个字符串 <code>s</code> ,验证 <code>s</code> 是否是 <strong>回文串 </strong>,只考虑字母和数字字符,可以忽略字母的大小写。</p>\n\n<p>本题中,将空字符串定义为有效的 <strong>回文串 </strong>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入: </strong>s =<strong> </strong>"A man, a plan, a canal: Panama"\n<strong>输出:</strong> true\n<strong>解释:</strong>"amanaplanacanalpanama" 是回文串</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> s = "race a car"\n<strong>输出:</strong> false\n解释:"raceacar" 不是回文串</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 2 * 10<sup>5</sup></code></li>\n\t<li>字符串 <code>s</code> 由 ASCII 字符组成</li>\n</ul>\n\n<p> </p>\n\n<p><meta charset=\"UTF-8\" />注意:本题与主站 125 题相同: <a href=\"https://leetcode-cn.com/problems/valid-palindrome/\">https://leetcode-cn.com/problems/valid-palindrome/</a></p>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 17,
|
||||
"likes": 21,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -150,7 +150,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"16.3K\", \"totalSubmission\": \"31.6K\", \"totalAcceptedRaw\": 16283, \"totalSubmissionRaw\": 31579, \"acRate\": \"51.6%\"}",
|
||||
"stats": "{\"totalAccepted\": \"19K\", \"totalSubmission\": \"36.9K\", \"totalAcceptedRaw\": 18974, \"totalSubmissionRaw\": 36862, \"acRate\": \"51.5%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -12,7 +12,7 @@
|
||||
"translatedContent": "前往「力扣挑战赛」场馆的道路上,有一个拥堵的十字路口,该十字路口由两条双向两车道的路交叉构成。由于信号灯故障,交警需要手动指挥拥堵车辆。假定路口没有新的来车且一辆车从一个车道驶入另一个车道所需的时间恰好为一秒钟,长度为 4 的一维字符串数组 `directions` 中按照 **东、南、西、北** 顺序记录了四个方向从最靠近路口到最远离路口的车辆计划开往的方向。其中:\n- `\"E\"` 表示向东行驶;\n- `\"S\"` 表示向南行驶;\n- `\"W\"` 表示向西行驶;\n- `\"N\"` 表示向北行驶。\n\n交警每秒钟只能指挥各个车道距离路口最近的一辆车,且每次指挥需要满足如下规则:\n- 同一秒钟内,一个方向的车道只允许驶出一辆车;\n- 同一秒钟内,一个方向的车道只允许驶入一辆车;\n- 同一秒钟内,车辆的行驶路线不可相交。\n\n请返回最少需要几秒钟,该十字路口等候的车辆才能全部走完。\n\n各个车道驶出的车辆可能的行驶路线如图所示:\n\n\n{:height=\"350px\"}\n\n**注意:**\n- 测试数据保证不会出现掉头行驶指令,即某一方向的行驶车辆计划开往的方向不会是当前车辆所在的车道的方向;\n- 表示堵塞车辆行驶方向的字符串仅用大写字母 `\"E\"`,`\"N\"`,`\"W\"`,`\"S\"` 表示。\n\n**示例 1:**\n>输入:`directions = [\"W\",\"N\",\"ES\",\"W\"]`\n>\n>输出:`2`\n>\n>解释:\n>第 1 秒:东西方向排在最前的车先行,剩余车辆状态 `[\"\",\"N\",\"S\",\"W\"]`;\n>第 2 秒:南、西、北方向的车行驶,路口无等待车辆;\n>因此最少需要 2 秒,返回 2。\n\n**示例 2:**\n>输入:`directions = [\"NS\",\"WE\",\"SE\",\"EW\"]`\n>\n>输出:`3`\n>\n>解释:\n>第 1 秒:四个方向排在最前的车均可驶出;\n>第 2 秒:东南方向的车驶出,剩余车辆状态 `[\"\",\"\",\"E\",\"W\"]`;\n>第 3 秒:西北方向的车驶出。\n\n\n**提示:**\n- `directions.length = 4`\n- `0 <= directions[i].length <= 20`\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Hard",
|
||||
"likes": 8,
|
||||
"likes": 9,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"556\", \"totalSubmission\": \"1.2K\", \"totalAcceptedRaw\": 556, \"totalSubmissionRaw\": 1213, \"acRate\": \"45.8%\"}",
|
||||
"stats": "{\"totalAccepted\": \"622\", \"totalSubmission\": \"1.3K\", \"totalAcceptedRaw\": 622, \"totalSubmissionRaw\": 1330, \"acRate\": \"46.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
@ -156,7 +156,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"6.2K\", \"totalSubmission\": \"10.7K\", \"totalAcceptedRaw\": 6181, \"totalSubmissionRaw\": 10654, \"acRate\": \"58.0%\"}",
|
||||
"stats": "{\"totalAccepted\": \"7.4K\", \"totalSubmission\": \"12.8K\", \"totalAcceptedRaw\": 7430, \"totalSubmissionRaw\": 12817, \"acRate\": \"58.0%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user