mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 01:11:42 +08:00
移除零宽空格
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
"boundTopicId": 842644,
|
||||
"title": "Remove All Occurrences of a Substring",
|
||||
"titleSlug": "remove-all-occurrences-of-a-substring",
|
||||
"content": "<p>Given two strings <code>s</code> and <code>part</code>, perform the following operation on <code>s</code> until <strong>all</strong> occurrences of the substring <code>part</code> are removed:</p>\n\n<ul>\n\t<li>Find the <strong>leftmost</strong> occurrence of the substring <code>part</code> and <strong>remove</strong> it from <code>s</code>.</li>\n</ul>\n\n<p>Return <code>s</code><em> after removing all occurrences of </em><code>part</code>.</p>\n\n<p>A <strong>substring</strong> is a contiguous sequence of characters in a string.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "daabcbaabcbc", part = "abc"\n<strong>Output:</strong> "dab"\n<strong>Explanation</strong>: The following operations are done:\n- s = "da<strong><u>abc</u></strong>baabcbc", remove "abc" starting at index 2, so s = "dabaabcbc".\n- s = "daba<strong><u>abc</u></strong>bc", remove "abc" starting at index 4, so s = "dababc".\n- s = "dab<strong><u>abc</u></strong>", remove "abc" starting at index 3, so s = "dab".\nNow s has no occurrences of "abc".\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "axxxxyyyyb", part = "xy"\n<strong>Output:</strong> "ab"\n<strong>Explanation</strong>: The following operations are done:\n- s = "axxx<strong><u>xy</u></strong>yyyb", remove "xy" starting at index 4 so s = "axxxyyyb".\n- s = "axx<strong><u>xy</u></strong>yyb", remove "xy" starting at index 3 so s = "axxyyb".\n- s = "ax<strong><u>xy</u></strong>yb", remove "xy" starting at index 2 so s = "axyb".\n- s = "a<strong><u>xy</u></strong>b", remove "xy" starting at index 1 so s = "ab".\nNow s has no occurrences of "xy".\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 1000</code></li>\n\t<li><code>1 <= part.length <= 1000</code></li>\n\t<li><code>s</code> and <code>part</code> consists of lowercase English letters.</li>\n</ul>\n",
|
||||
"content": "<p>Given two strings <code>s</code> and <code>part</code>, perform the following operation on <code>s</code> until <strong>all</strong> occurrences of the substring <code>part</code> are removed:</p>\n\n<ul>\n\t<li>Find the <strong>leftmost</strong> occurrence of the substring <code>part</code> and <strong>remove</strong> it from <code>s</code>.</li>\n</ul>\n\n<p>Return <code>s</code><em> after removing all occurrences of </em><code>part</code>.</p>\n\n<p>A <strong>substring</strong> is a contiguous sequence of characters in a string.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "daabcbaabcbc", part = "abc"\n<strong>Output:</strong> "dab"\n<strong>Explanation</strong>: The following operations are done:\n- s = "da<strong><u>abc</u></strong>baabcbc", remove "abc" starting at index 2, so s = "dabaabcbc".\n- s = "daba<strong><u>abc</u></strong>bc", remove "abc" starting at index 4, so s = "dababc".\n- s = "dab<strong><u>abc</u></strong>", remove "abc" starting at index 3, so s = "dab".\nNow s has no occurrences of "abc".\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "axxxxyyyyb", part = "xy"\n<strong>Output:</strong> "ab"\n<strong>Explanation</strong>: The following operations are done:\n- s = "axxx<strong><u>xy</u></strong>yyyb", remove "xy" starting at index 4 so s = "axxxyyyb".\n- s = "axx<strong><u>xy</u></strong>yyb", remove "xy" starting at index 3 so s = "axxyyb".\n- s = "ax<strong><u>xy</u></strong>yb", remove "xy" starting at index 2 so s = "axyb".\n- s = "a<strong><u>xy</u></strong>b", remove "xy" starting at index 1 so s = "ab".\nNow s has no occurrences of "xy".\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 1000</code></li>\n\t<li><code>1 <= part.length <= 1000</code></li>\n\t<li><code>s</code> and <code>part</code> consists of lowercase English letters.</li>\n</ul>\n",
|
||||
"translatedTitle": "删除一个字符串中所有出现的给定子字符串",
|
||||
"translatedContent": "<p>给你两个字符串 <code>s</code> 和 <code>part</code> ,请你对 <code>s</code> 反复执行以下操作直到 <b>所有</b> 子字符串 <code>part</code> 都被删除:</p>\n\n<ul>\n\t<li>找到 <code>s</code> 中 <strong>最左边</strong> 的子字符串 <code>part</code> ,并将它从 <code>s</code> 中删除。</li>\n</ul>\n\n<p>请你返回从 <code>s</code> 中删除所有 <code>part</code> 子字符串以后得到的剩余字符串。</p>\n\n<p>一个 <strong>子字符串</strong> 是一个字符串中连续的字符序列。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><b>输入:</b>s = \"daabcbaabcbc\", part = \"abc\"\n<b>输出:</b>\"dab\"\n<b>解释:</b>以下操作按顺序执行:\n- s = \"da<strong>abc</strong>baabcbc\" ,删除下标从 2 开始的 \"abc\" ,得到 s = \"dabaabcbc\" 。\n- s = \"daba<strong>abc</strong>bc\" ,删除下标从 4 开始的 \"abc\" ,得到 s = \"dababc\" 。\n- s = \"dab<strong>abc</strong>\" ,删除下标从 3 开始的 \"abc\" ,得到 s = \"dab\" 。\n此时 s 中不再含有子字符串 \"abc\" 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><b>输入:</b>s = \"axxxxyyyyb\", part = \"xy\"\n<b>输出:</b>\"ab\"\n<b>解释:</b>以下操作按顺序执行:\n- s = \"axxx<strong>xy</strong>yyyb\" ,删除下标从 4 开始的 \"xy\" ,得到 s = \"axxxyyyb\" 。\n- s = \"axx<strong>xy</strong>yyb\" ,删除下标从 3 开始的 \"xy\" ,得到 s = \"axxyyb\" 。\n- s = \"ax<strong>xy</strong>yb\" ,删除下标从 2 开始的 \"xy\" ,得到 s = \"axyb\" 。\n- s = \"a<strong>xy</strong>b\" ,删除下标从 1 开始的 \"xy\" ,得到 s = \"ab\" 。\n此时 s 中不再含有子字符串 \"xy\" 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 1000</code></li>\n\t<li><code>1 <= part.length <= 1000</code></li>\n\t<li><code>s</code> 和 <code>part</code> 只包小写英文字母。</li>\n</ul>\n",
|
||||
"translatedContent": "<p>给你两个字符串 <code>s</code> 和 <code>part</code> ,请你对 <code>s</code> 反复执行以下操作直到 <b>所有</b> 子字符串 <code>part</code> 都被删除:</p>\n\n<ul>\n\t<li>找到 <code>s</code> 中 <strong>最左边</strong> 的子字符串 <code>part</code> ,并将它从 <code>s</code> 中删除。</li>\n</ul>\n\n<p>请你返回从 <code>s</code> 中删除所有 <code>part</code> 子字符串以后得到的剩余字符串。</p>\n\n<p>一个 <strong>子字符串</strong> 是一个字符串中连续的字符序列。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre><b>输入:</b>s = \"daabcbaabcbc\", part = \"abc\"\n<b>输出:</b>\"dab\"\n<b>解释:</b>以下操作按顺序执行:\n- s = \"da<strong>abc</strong>baabcbc\" ,删除下标从 2 开始的 \"abc\" ,得到 s = \"dabaabcbc\" 。\n- s = \"daba<strong>abc</strong>bc\" ,删除下标从 4 开始的 \"abc\" ,得到 s = \"dababc\" 。\n- s = \"dab<strong>abc</strong>\" ,删除下标从 3 开始的 \"abc\" ,得到 s = \"dab\" 。\n此时 s 中不再含有子字符串 \"abc\" 。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre><b>输入:</b>s = \"axxxxyyyyb\", part = \"xy\"\n<b>输出:</b>\"ab\"\n<b>解释:</b>以下操作按顺序执行:\n- s = \"axxx<strong>xy</strong>yyyb\" ,删除下标从 4 开始的 \"xy\" ,得到 s = \"axxxyyyb\" 。\n- s = \"axx<strong>xy</strong>yyb\" ,删除下标从 3 开始的 \"xy\" ,得到 s = \"axxyyb\" 。\n- s = \"ax<strong>xy</strong>yb\" ,删除下标从 2 开始的 \"xy\" ,得到 s = \"axyb\" 。\n- s = \"a<strong>xy</strong>b\" ,删除下标从 1 开始的 \"xy\" ,得到 s = \"ab\" 。\n此时 s 中不再含有子字符串 \"xy\" 。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 1000</code></li>\n\t<li><code>1 <= part.length <= 1000</code></li>\n\t<li><code>s</code> 和 <code>part</code> 只包小写英文字母。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 34,
|
||||
|
Reference in New Issue
Block a user