mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-09 01:11:42 +08:00
移除零宽空格
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
"boundTopicId": null,
|
||||
"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": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
|
Reference in New Issue
Block a user