Skip to content

[pull] main from doocs:main #514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lcp/LCP 62. 交通枢纽/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
> 解释:如下图所示:
> 地点 `0,1,2` 各有一条通往地点 `3` 的交通专线,
> 且地点 `3` 不存在任何**通往其他地点**的交通专线。
><br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2062.%20%E4%BA%A4%E9%80%9A%E6%9E%A2%E7%BA%BD/images/1663902572-yOlUCr-image.png" style="width: 200px;" />
> <br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2062.%20%E4%BA%A4%E9%80%9A%E6%9E%A2%E7%BA%BD/images/1663902572-yOlUCr-image.png" style="width: 200px;" />

**示例 2:**

Expand All @@ -34,7 +34,7 @@
> 输出:`-1`
>
> 解释:如下图所示:不存在满足 **交通枢纽** 的地点。
><br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2062.%20%E4%BA%A4%E9%80%9A%E6%9E%A2%E7%BA%BD/images/1663902595-McsEkY-image.png" style="width: 200px;" />
> <br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2062.%20%E4%BA%A4%E9%80%9A%E6%9E%A2%E7%BA%BD/images/1663902595-McsEkY-image.png" style="width: 200px;" />

**提示:**

Expand Down
6 changes: 3 additions & 3 deletions lcp/LCP 70. 沙地治理/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
> 如下图所示,(1,1)和(2,2)相邻,(3,2)和(3,3)相邻;(2,2)和(3,3)不相邻,因为它们没有共用边。
- 若至少有两片绿地与同一片沙地相邻,则这片沙地也会转化为绿地
- 转化为绿地的区域会影响其相邻的沙地
<br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2070.%20%E6%B2%99%E5%9C%B0%E6%B2%BB%E7%90%86/images/1662692397-VlvErS-image.png" style="width: 300px;" />
<br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2070.%20%E6%B2%99%E5%9C%B0%E6%B2%BB%E7%90%86/images/1662692397-VlvErS-image.png" style="width: 300px;" />

现要将一片边长为 `size`  的沙地全部转化为绿地,请找到任意一种初始指定 **最少** 数量子区域种植沙柳的方案,并返回所有初始种植沙柳树的绿地坐标。

Expand All @@ -25,7 +25,7 @@
> 指定所示的 5 个子区域为绿地。
> 相邻至少两片绿地的 (2,2),(3,2) 和 (3,4) 演变为绿地。
> 相邻两片绿地的 (3,3) 演变为绿地。
><br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2070.%20%E6%B2%99%E5%9C%B0%E6%B2%BB%E7%90%86/images/1662692503-ncjywh-image.png" style="width: 300px;" />
> <br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2070.%20%E6%B2%99%E5%9C%B0%E6%B2%BB%E7%90%86/images/1662692503-ncjywh-image.png" style="width: 300px;" />

**示例 2:**

Expand All @@ -34,7 +34,7 @@
> 解释:如下图所示:
> 指定所示的 3 个子区域为绿地。
> 相邻三片绿地的 (2,2) 演变为绿地。
><br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2070.%20%E6%B2%99%E5%9C%B0%E6%B2%BB%E7%90%86/images/1662692507-mgFXRj-image.png" style="width: 300px;" />
> <br><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/lcp/LCP%2070.%20%E6%B2%99%E5%9C%B0%E6%B2%BB%E7%90%86/images/1662692507-mgFXRj-image.png" style="width: 300px;" />

**提示:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
<pre>
<strong>输入: </strong>s = "abcabcbb"
<strong>输出: </strong>3
<strong>解释:</strong> 因为无重复字符的最长子串是 <code>"abc",所以其</code>长度为 3。
<strong>解释:</strong> 因为无重复字符的最长子串是 "abc",所以其长度为 3。
</pre>

<p><strong>示例 2:</strong></p>

<pre>
<strong>输入: </strong>s = "bbbbb"
<strong>输出: </strong>1
<strong>解释: </strong>因为无重复字符的最长子串是 <code>"b"</code>,所以其长度为 1。
<strong>解释: </strong>因为无重复字符的最长子串是 "b",所以其长度为 1。
</pre>

<p><strong>示例 3:</strong></p>

<pre>
<strong>输入: </strong>s = "pwwkew"
<strong>输出: </strong>3
<strong>解释: </strong>因为无重复字符的最长子串是&nbsp;<code>"wke"</code>,所以其长度为 3。
&nbsp; 请注意,你的答案必须是 <strong>子串 </strong>的长度,<code>"pwke"</code>&nbsp;是一个<em>子序列,</em>不是子串。
<strong>解释: </strong>因为无重复字符的最长子串是 "wke",所以其长度为 3。
请注意,你的答案必须是 <strong>子串 </strong>的长度,"pwke" 是一个<em>子序列,</em>不是子串。
</pre>

<p>&nbsp;</p>
Expand Down
4 changes: 2 additions & 2 deletions solution/0000-0099/0006.Zigzag Conversion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func convert(s string, numRows int) string {
*/
var convert = function (s, numRows) {
if (numRows == 1) return s;
let arr = new Array(numRows);
const arr = new Array(numRows);
for (let i = 0; i < numRows; i++) arr[i] = [];
let mi = 0,
isDown = true;
Expand All @@ -225,7 +225,7 @@ var convert = function (s, numRows) {
else mi--;
}
let ans = [];
for (let item of arr) {
for (const item of arr) {
ans = ans.concat(item);
}
return ans.join('');
Expand Down
4 changes: 2 additions & 2 deletions solution/0000-0099/0006.Zigzag Conversion/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func convert(s string, numRows int) string {
*/
var convert = function (s, numRows) {
if (numRows == 1) return s;
let arr = new Array(numRows);
const arr = new Array(numRows);
for (let i = 0; i < numRows; i++) arr[i] = [];
let mi = 0,
isDown = true;
Expand All @@ -219,7 +219,7 @@ var convert = function (s, numRows) {
else mi--;
}
let ans = [];
for (let item of arr) {
for (const item of arr) {
ans = ans.concat(item);
}
return ans.join('');
Expand Down
4 changes: 2 additions & 2 deletions solution/0000-0099/0006.Zigzag Conversion/Solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
var convert = function (s, numRows) {
if (numRows == 1) return s;
let arr = new Array(numRows);
const arr = new Array(numRows);
for (let i = 0; i < numRows; i++) arr[i] = [];
let mi = 0,
isDown = true;
Expand All @@ -19,7 +19,7 @@ var convert = function (s, numRows) {
else mi--;
}
let ans = [];
for (let item of arr) {
for (const item of arr) {
ans = ans.concat(item);
}
return ans.join('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
<p><strong>示例 1:</strong></p>

<pre>
<strong>输入:</strong>nums = [<code>4,5,6,7,0,1,2]</code>, target = 0
<strong>输入:</strong>nums = [4,5,6,7,0,1,2], target = 0
<strong>输出:</strong>4
</pre>

<p><strong>示例&nbsp;2:</strong></p>

<pre>
<strong>输入:</strong>nums = [<code>4,5,6,7,0,1,2]</code>, target = 3
<strong>输入:</strong>nums = [4,5,6,7,0,1,2], target = 3
<strong>输出:</strong>-1</pre>

<p><strong>示例 3:</strong></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<p><strong>示例 1:</strong></p>

<pre>
<strong>输入:</strong>nums = [<code>5,7,7,8,8,10]</code>, target = 8
<strong>输入:</strong>nums = [5,7,7,8,8,10], target = 8
<strong>输出:</strong>[3,4]</pre>

<p><strong>示例&nbsp;2:</strong></p>

<pre>
<strong>输入:</strong>nums = [<code>5,7,7,8,8,10]</code>, target = 6
<strong>输入:</strong>nums = [5,7,7,8,8,10], target = 6
<strong>输出:</strong>[-1,-1]</pre>

<p><strong>示例 3:</strong></p>
Expand Down
73 changes: 32 additions & 41 deletions solution/0000-0099/0044.Wildcard Matching/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,53 @@

<!-- 这里写题目描述 -->

<p>给定一个字符串&nbsp;(<code>s</code>) 和一个字符模式&nbsp;(<code>p</code>) ,实现一个支持&nbsp;<code>&#39;?&#39;</code>&nbsp;和&nbsp;<code>&#39;*&#39;</code>&nbsp;的通配符匹配。</p>

<pre>&#39;?&#39; 可以匹配任何单个字符。
&#39;*&#39; 可以匹配任意字符串(包括空字符串)。
</pre>

<p>两个字符串<strong>完全匹配</strong>才算匹配成功。</p>

<p><strong>说明:</strong></p>
<div class="title__3Vvk">给你一个输入字符串 (<code>s</code>) 和一个字符模式 (<code>p</code>) ,请你实现一个支持 <code>'?'</code> 和 <code>'*'</code> 匹配规则的通配符匹配:</div>

<ul>
<li><code>s</code>&nbsp;可能为空,且只包含从&nbsp;<code>a-z</code>&nbsp;的小写字母。</li>
<li><code>p</code>&nbsp;可能为空,且只包含从&nbsp;<code>a-z</code>&nbsp;的小写字母,以及字符&nbsp;<code>?</code>&nbsp;和&nbsp;<code>*</code>。</li>
<li class="title__3Vvk"><code>'?'</code> 可以匹配任何单个字符。</li>
<li class="title__3Vvk"><code>'*'</code> 可以匹配任意字符序列(包括空字符序列)。</li>
</ul>

<p><strong>示例&nbsp;1:</strong></p>
<div class="original__bRMd">
<div>
<p>判定匹配成功的充要条件是:字符模式必须能够 <strong>完全匹配</strong> 输入字符串(而不是部分匹配)。</p>
</div>
</div>
&nbsp;

<pre><strong>输入:</strong>
s = &quot;aa&quot;
p = &quot;a&quot;
<strong>输出:</strong> false
<strong>解释:</strong> &quot;a&quot; 无法匹配 &quot;aa&quot; 整个字符串。</pre>
<p><strong class="example">示例 1:</strong></p>

<p><strong>示例&nbsp;2:</strong></p>

<pre><strong>输入:</strong>
s = &quot;aa&quot;
p = &quot;*&quot;
<strong>输出:</strong> true
<strong>解释:</strong>&nbsp;&#39;*&#39; 可以匹配任意字符串。
<pre>
<strong>输入:</strong>s = "aa", p = "a"
<strong>输出:</strong>false
<strong>解释:</strong>"a" 无法匹配 "aa" 整个字符串。
</pre>

<p><strong>示例&nbsp;3:</strong></p>
<p><strong class="example">示例 2:</strong></p>

<pre><strong>输入:</strong>
s = &quot;cb&quot;
p = &quot;?a&quot;
<strong>输出:</strong> false
<strong>解释:</strong>&nbsp;&#39;?&#39; 可以匹配 &#39;c&#39;, 但第二个 &#39;a&#39; 无法匹配 &#39;b&#39;。
<pre>
<strong>输入:</strong>s = "aa", p = "*"
<strong>输出:</strong>true
<strong>解释:</strong>'*' 可以匹配任意字符串。
</pre>

<p><strong>示例&nbsp;4:</strong></p>
<p><strong class="example">示例 3:</strong></p>

<pre><strong>输入:</strong>
s = &quot;adceb&quot;
p = &quot;*a*b&quot;
<strong>输出:</strong> true
<strong>解释:</strong>&nbsp;第一个 &#39;*&#39; 可以匹配空字符串, 第二个 &#39;*&#39; 可以匹配字符串 &quot;dce&quot;.
<pre>
<strong>输入:</strong>s = "cb", p = "?a"
<strong>输出:</strong>false
<strong>解释:</strong>'?' 可以匹配 'c', 但第二个 'a' 无法匹配 'b'。
</pre>

<p><strong>示例&nbsp;5:</strong></p>
<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<pre><strong>输入:</strong>
s = &quot;acdcb&quot;
p = &quot;a*c?b&quot;
<strong>输出:</strong> false</pre>
<ul>
<li><code>0 &lt;= s.length, p.length &lt;= 2000</code></li>
<li><code>s</code> 仅由小写英文字母组成</li>
<li><code>p</code> 仅由小写英文字母、<code>'?'</code> 或 <code>'*'</code> 组成</li>
</ul>

## 解法

Expand Down
18 changes: 8 additions & 10 deletions solution/0100-0199/0115.Distinct Subsequences/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,43 @@

<!-- 这里写题目描述 -->

<p>给定一个字符串 <code>s</code><strong> </strong>和一个字符串 <code>t</code> ,计算在 <code>s</code> 的子序列中 <code>t</code> 出现的个数。</p>

<p>字符串的一个 <strong>子序列</strong> 是指,通过删除一些(也可以不删除)字符且不干扰剩余字符相对位置所组成的新字符串。(例如,<code>"ACE"</code> 是 <code>"ABCDE"</code> 的一个子序列,而 <code>"AEC"</code> 不是)</p>
<p>给你两个字符串 <code>s</code><strong> </strong>和 <code>t</code> ,统计并返回在 <code>s</code> 的 <strong>子序列</strong> 中 <code>t</code> 出现的个数。</p>

<p>题目数据保证答案符合 32 位带符号整数范围。</p>

<p> </p>
<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>
<p><strong>示例&nbsp;1:</strong></p>

<pre>
<strong>输入:</strong>s = "rabbbit", t = "rabbit"<code>
<strong>输出</strong></code><strong>:</strong><code>3
</code><strong>解释:</strong>
如下图所示, 有 3 种可以从 s 中得到 <code>"rabbit" 的方案</code>。
如下所示, 有 3 种可以从 s 中得到 <code>"rabbit" 的方案</code>。
<code><strong><u>rabb</u></strong>b<strong><u>it</u></strong></code>
<code><strong><u>ra</u></strong>b<strong><u>bbit</u></strong></code>
<code><strong><u>rab</u></strong>b<strong><u>bit</u></strong></code></pre>

<p><strong>示例 2:</strong></p>
<p><strong>示例&nbsp;2:</strong></p>

<pre>
<strong>输入:</strong>s = "babgbag", t = "bag"
<code><strong>输出</strong></code><strong>:</strong><code>5
</code><strong>解释:</strong>
如下图所示, 有 5 种可以从 s 中得到 <code>"bag" 的方案</code>。
如下所示, 有 5 种可以从 s 中得到 <code>"bag" 的方案</code>。
<code><strong><u>ba</u></strong>b<u><strong>g</strong></u>bag</code>
<code><strong><u>ba</u></strong>bgba<strong><u>g</u></strong></code>
<code><u><strong>b</strong></u>abgb<strong><u>ag</u></strong></code>
<code>ba<u><strong>b</strong></u>gb<u><strong>ag</strong></u></code>
<code>babg<strong><u>bag</u></strong></code>
</pre>

<p> </p>
<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ul>
<li><code>0 <= s.length, t.length <= 1000</code></li>
<li><code>1 &lt;= s.length, t.length &lt;= 1000</code></li>
<li><code>s</code> 和 <code>t</code> 由英文字母组成</li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions solution/0100-0199/0140.Word Break II/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<li><code>1 &lt;= wordDict[i].length &lt;= 10</code></li>
<li><code>s</code> and <code>wordDict[i]</code> consist of only lowercase English letters.</li>
<li>All the strings of <code>wordDict</code> are <strong>unique</strong>.</li>
<li>Input is generated in a way that the length of the answer doesn&#39;t exceed&nbsp;10<sup>5</sup>.</li>
</ul>

## Solutions
Expand Down
Loading