Skip to content

Commit 0ad4f70

Browse files
authored
chore: update lc problems (doocs#1588)
1 parent 74ca58c commit 0ad4f70

File tree

65 files changed

+218
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+218
-221
lines changed

index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
const isEn = () => location.hash.includes('README_EN');
2929
const isRoot = () => ['', '#/', '#/README', '#/README_EN'].includes(location.hash);
3030
const sidebar = () => isRoot() ? false : (isEn() ? 'summary_en.md' : 'summary.md');
31+
const cleanedHtml = (html) => {
32+
return html.replace(/<pre>([\s\S]*?)<\/pre>/g, function (match, group) {
33+
return "<pre>" + group.replace(/<code>([\s\S]*?)<\/code>/g, "$1") + "</pre>";
34+
});
35+
};
3136

3237
window.addEventListener('hashchange', () => {
3338
window.$docsify.loadSidebar = sidebar();
@@ -111,6 +116,7 @@
111116

112117
const github = `[GitHub](${url})`
113118
const gitee = `[Gitee](${url.replace("github", "gitee")})`
119+
html = cleanedHtml(html);
114120
const editHtml = isEn() ? `:memo: Edit on ${github} / ${gitee}\n` : `:memo: 在 ${github} / ${gitee} 编辑\n`
115121
return editHtml + html
116122
})

solution/0000-0099/0003.Longest Substring Without Repeating Characters/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@
1515
<pre>
1616
<strong>输入: </strong>s = "abcabcbb"
1717
<strong>输出: </strong>3
18-
<strong>解释:</strong> 因为无重复字符的最长子串是 "abc",所以其长度为 3。
18+
<strong>解释:</strong> 因为无重复字符的最长子串是 <code>"abc"</code>,所以其长度为 3。
1919
</pre>
2020

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

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

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

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

3838
<p>&nbsp;</p>

solution/0000-0099/0030.Substring with Concatenation of All Words/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
<li>例如,如果&nbsp;<code>words = ["ab","cd","ef"]</code>, 那么&nbsp;<code>"abcdef"</code>,&nbsp;<code>"abefcd"</code>,<code>"cdabef"</code>,&nbsp;<code>"cdefab"</code>,<code>"efabcd"</code>, 和&nbsp;<code>"efcdab"</code> 都是串联子串。&nbsp;<code>"acdbef"</code> 不是串联子串,因为他不是任何&nbsp;<code>words</code>&nbsp;排列的连接。</li>
1515
</ul>
1616

17-
<p>返回所有串联字串在&nbsp;<code>s</code><strong>&nbsp;</strong>中的开始索引。你可以以 <strong>任意顺序</strong> 返回答案。</p>
17+
<p>返回所有串联子串在&nbsp;<code>s</code><strong>&nbsp;</strong>中的开始索引。你可以以 <strong>任意顺序</strong> 返回答案。</p>
1818

1919
<p>&nbsp;</p>
2020

2121
<p><strong>示例 1:</strong></p>
2222

2323
<pre>
2424
<strong>输入:</strong>s = "barfoothefoobarman", words = ["foo","bar"]
25-
<strong>输出:</strong>[0,9]
25+
<strong>输出:</strong><code>[0,9]</code>
2626
<strong>解释:</strong>因为 words.length == 2 同时 words[i].length == 3,连接的子字符串的长度必须为 6。
2727
子串 "barfoo" 开始位置是 0。它是 words 中以 ["bar","foo"] 顺序排列的连接。
2828
子串 "foobar" 开始位置是 9。它是 words 中以 ["foo","bar"] 顺序排列的连接。
@@ -33,7 +33,7 @@
3333

3434
<pre>
3535
<strong>输入:</strong>s = "wordgoodgoodgoodbestword", words = ["word","good","best","word"]
36-
<strong>输出:</strong>[]
36+
<code><strong>输出:</strong>[]</code>
3737
<strong>解释:</strong>因为<strong> </strong>words.length == 4 并且 words[i].length == 4,所以串联子串的长度必须为 16。
3838
s 中没有子串长度为 16 并且等于 words 的任何顺序排列的连接。
3939
所以我们返回一个空数组。

solution/0000-0099/0030.Substring with Concatenation of All Words/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The output order does not matter. Returning [9,0] is fine too.
3232
<strong>Input:</strong> s = &quot;wordgoodgoodgoodbestword&quot;, words = [&quot;word&quot;,&quot;good&quot;,&quot;best&quot;,&quot;word&quot;]
3333
<strong>Output:</strong> []
3434
<strong>Explanation:</strong> Since words.length == 4 and words[i].length == 4, the concatenated substring has to be of length 16.
35-
There is no substring of length 16 is s that is equal to the concatenation of any permutation of words.
35+
There is no substring of length 16 in s that is equal to the concatenation of any permutation of words.
3636
We return an empty array.
3737
</pre>
3838

solution/0000-0099/0033.Search in Rotated Sorted Array/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
<p><strong>示例 1:</strong></p>
2020

2121
<pre>
22-
<strong>输入:</strong>nums = [4,5,6,7,0,1,2], target = 0
22+
<strong>输入:</strong>nums = [<code>4,5,6,7,0,1,2]</code>, target = 0
2323
<strong>输出:</strong>4
2424
</pre>
2525

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

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

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

solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
<p><strong>示例 1:</strong></p>
1818

1919
<pre>
20-
<strong>输入:</strong>nums = [5,7,7,8,8,10], target = 8
20+
<strong>输入:</strong>nums = [<code>5,7,7,8,8,10]</code>, target = 8
2121
<strong>输出:</strong>[3,4]</pre>
2222

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

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

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

solution/0000-0099/0038.Count and Say/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
4. 1211
2727
5. 111221
2828
第一项是数字 1
29-
描述前一项,这个数是 1 即 “ 一 个 1 ”,记作 "11"
30-
描述前一项,这个数是 11 即 “ 二 个 1 ” ,记作 "21"
31-
描述前一项,这个数是 21 即 “ 一 个 2 + 一 个 1 ” ,记作 "1211"
32-
描述前一项,这个数是 1211 即 “ 一 个 1 + 一 个 2 + 二 个 1 ” ,记作 "111221"
29+
描述前一项,这个数是 <code>1</code> 即 “ 一 个 1 ”,记作 <code>"11"
30+
</code>描述前一项,这个数是 <code>11</code> 即 “ 二 个 1 ” ,记作 <code>"21"
31+
</code>描述前一项,这个数是 <code>21</code> 即 “ 一 个 2 + 一 个 1 ” ,记作 "<code>1211"
32+
</code>描述前一项,这个数是 <code>1211</code> 即 “ 一 个 1 + 一 个 2 + 二 个 1 ” ,记作 "<code>111221"</code>
3333
</pre>
3434

3535
<p>要 <strong>描述</strong> 一个数字字符串,首先要将字符串分割为 <strong>最小</strong> 数量的组,每个组都由连续的最多 <strong>相同字符</strong> 组成。然后对于每个组,先描述字符的数量,然后描述字符,形成一个描述组。要将描述转换为数字字符串,先将每组中的字符数量用数字替换,再将所有描述组连接起来。</p>

solution/0000-0099/0039.Combination Sum/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<p><strong>示例&nbsp;1:</strong></p>
1818

1919
<pre>
20-
<strong>输入:</strong>candidates = [2,3,6,7], target = 7
20+
<strong>输入:</strong>candidates = <code>[2,3,6,7], </code>target = <code>7</code>
2121
<strong>输出:</strong>[[2,2,3],[7]]
2222
<strong>解释:</strong>
2323
2 和 3 可以形成一组候选,2 + 2 + 3 = 7 。注意 2 可以使用多次。
@@ -27,13 +27,13 @@
2727
<p><strong>示例&nbsp;2:</strong></p>
2828

2929
<pre>
30-
<strong>输入: </strong>candidates = [2,3,5], target = 8
30+
<strong>输入: </strong>candidates = [2,3,5]<code>, </code>target = 8
3131
<strong>输出: </strong>[[2,2,2,2],[2,3,3],[3,5]]</pre>
3232

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

3535
<pre>
36-
<strong>输入: </strong>candidates = [2], target = 1
36+
<strong>输入: </strong>candidates = <code>[2], </code>target = 1
3737
<strong>输出: </strong>[]
3838
</pre>
3939

solution/0000-0099/0040.Combination Sum II/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<p><strong>示例&nbsp;1:</strong></p>
1818

1919
<pre>
20-
<strong>输入:</strong> candidates =&nbsp;[10,1,2,7,6,1,5], target =&nbsp;8,
20+
<strong>输入:</strong> candidates =&nbsp;<code>[10,1,2,7,6,1,5]</code>, target =&nbsp;<code>8</code>,
2121
<strong>输出:</strong>
2222
[
2323
[1,1,6],

solution/0000-0099/0057.Insert Interval/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<pre>
2525
<strong>输入:</strong>intervals = [[1,2],[3,5],[6,7],[8,10],[12,16]], newInterval = [4,8]
2626
<strong>输出:</strong>[[1,2],[3,10],[12,16]]
27-
<strong>解释:</strong>这是因为新的区间 [4,8] 与 [3,5],[6,7],[8,10] 重叠。</pre>
27+
<strong>解释:</strong>这是因为新的区间 <code>[4,8]</code><code>[3,5],[6,7],[8,10]</code> 重叠。</pre>
2828

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

0 commit comments

Comments
 (0)