1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-07 00:11:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个字符串 <code>s</code> 和一个字符 <code>c</code> ,且 <code>c</code> 是 <code>s</code> 中出现过的字符。</p>\n\n<p>返回一个整数数组 <code>answer</code> ,其中 <code>answer.length == s.length</code> 且 <code>answer[i]</code> 是 <code>s</code> 中从下标 <code>i</code> 到离它 <strong>最近</strong> 的字符 <code>c</code> 的 <strong>距离</strong> 。</p>\n\n<p>两个下标&nbsp;<code>i</code> 和 <code>j</code> 之间的 <strong>距离</strong> 为 <code>abs(i - j)</code> ,其中 <code>abs</code> 是绝对值函数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"loveleetcode\", c = \"e\"\n<strong>输出:</strong>[3,2,1,0,1,0,0,1,2,2,1,0]\n<strong>解释:</strong>字符 'e' 出现在下标 3、5、6 和 11 处(下标从 0 开始计数)。\n距下标 0 最近的 'e' 出现在下标 3 ,所以距离为 abs(0 - 3) = 3 。\n距下标 1 最近的 'e' 出现在下标 3 ,所以距离为 abs(1 - 3) = 2 。\n对于下标 4 ,出现在下标 3 和下标 5 处的 'e' 都离它最近,但距离是一样的 abs(4 - 3) == abs(4 - 5) = 1 。\n距下标 8 最近的 'e' 出现在下标 6 ,所以距离为 abs(8 - 6) = 2 。\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre>\n<strong>输入:</strong>s = \"aaab\", c = \"b\"\n<strong>输出:</strong>[3,2,1,0]\n</pre>\n\n<p>&nbsp;</p>\n<strong>提示:</strong>\n\n<ul>\n\t<li><code>1 &lt;= s.length &lt;= 10<sup>4</sup></code></li>\n\t<li><code>s[i]</code> 和 <code>c</code> 均为小写英文字母</li>\n\t<li>题目数据保证 <code>c</code> 在 <code>s</code> 中至少出现一次</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 216,
"likes": 295,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"29.6K\", \"totalSubmission\": \"42.7K\", \"totalAcceptedRaw\": 29573, \"totalSubmissionRaw\": 42673, \"acRate\": \"69.3%\"}",
"stats": "{\"totalAccepted\": \"64.6K\", \"totalSubmission\": \"88.1K\", \"totalAcceptedRaw\": 64640, \"totalSubmissionRaw\": 88111, \"acRate\": \"73.4%\"}",
"hints": [],
"solution": null,
"status": null,