mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>「HTML 实体解析器」 是一种特殊的解析器,它将 HTML 代码作为输入,并用字符本身替换掉所有这些特殊的字符实体。</p>\n\n<p>HTML 里这些特殊字符和它们对应的字符实体包括:</p>\n\n<ul>\n\t<li><strong>双引号:</strong>字符实体为 <code>&quot;</code> ,对应的字符是 <code>"</code> 。</li>\n\t<li><strong>单引号:</strong>字符实体为 <code>&apos;</code> ,对应的字符是 <code>'</code> 。</li>\n\t<li><strong>与符号:</strong>字符实体为 <code>&amp;</code> ,对应对的字符是 <code>&</code> 。</li>\n\t<li><strong>大于号:</strong>字符实体为 <code>&gt;</code> ,对应的字符是 <code>></code> 。</li>\n\t<li><strong>小于号:</strong>字符实体为 <code>&lt;</code> ,对应的字符是 <code><</code> 。</li>\n\t<li><strong>斜线号:</strong>字符实体为 <code>&frasl;</code> ,对应的字符是 <code>/</code> 。</li>\n</ul>\n\n<p>给你输入字符串 <code>text</code> ,请你实现一个 HTML 实体解析器,返回解析器解析后的结果。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>text = "&amp; is an HTML entity but &ambassador; is not."\n<strong>输出:</strong>"& is an HTML entity but &ambassador; is not."\n<strong>解释:</strong>解析器把字符实体 &amp; 用 & 替换\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>text = "and I quote: &quot;...&quot;"\n<strong>输出:</strong>"and I quote: \\"...\\""\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>text = "Stay home! Practice on Leetcode :)"\n<strong>输出:</strong>"Stay home! Practice on Leetcode :)"\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>text = "x &gt; y &amp;&amp; x &lt; y is always false"\n<strong>输出:</strong>"x > y && x < y is always false"\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>text = "leetcode.com&frasl;problemset&frasl;all"\n<strong>输出:</strong>"leetcode.com/problemset/all"\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= text.length <= 10^5</code></li>\n\t<li>字符串可能包含 256 个ASCII 字符中的任意字符。</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 17,
|
||||
"likes": 18,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -143,7 +143,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"8K\", \"totalSubmission\": \"16.8K\", \"totalAcceptedRaw\": 7992, \"totalSubmissionRaw\": 16809, \"acRate\": \"47.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"8.1K\", \"totalSubmission\": \"17K\", \"totalAcceptedRaw\": 8099, \"totalSubmissionRaw\": 17018, \"acRate\": \"47.6%\"}",
|
||||
"hints": [
|
||||
"Search the string for all the occurrences of the character '&'.",
|
||||
"For every '&' check if it matches an HTML entity by checking the ';' character and if entity found replace it in the answer."
|
||||
|
Reference in New Issue
Block a user