mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 13:06:47 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>实现 <a href=\"https://baike.baidu.com/item/strstr/811469\" target=\"_blank\">strStr()</a> 函数。</p>\n\n<p>给你两个字符串 <code>haystack</code> 和 <code>needle</code> ,请你在 <code>haystack</code> 字符串中找出 <code>needle</code> 字符串出现的第一个位置(下标从 0 开始)。如果不存在,则返回 <code>-1</code><strong> </strong>。</p>\n\n<p> </p>\n\n<p><strong>说明:</strong></p>\n\n<p>当 <code>needle</code> 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。</p>\n\n<p>对于本题而言,当 <code>needle</code> 是空字符串时我们应当返回 0 。这与 C 语言的 <a href=\"https://baike.baidu.com/item/strstr/811469\" target=\"_blank\">strstr()</a> 以及 Java 的 <a href=\"https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(java.lang.String)\" target=\"_blank\">indexOf()</a> 定义相符。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>haystack = \"hello\", needle = \"ll\"\n<strong>输出:</strong>2\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>haystack = \"aaaaa\", needle = \"bba\"\n<strong>输出:</strong>-1\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>haystack = \"\", needle = \"\"\n<strong>输出:</strong>0\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 <= haystack.length, needle.length <= 5 * 10<sup>4</sup></code></li>\n\t<li><code>haystack</code> 和 <code>needle</code> 仅由小写英文字符组成</li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 1339,
|
||||
"likes": 1346,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Shortest Palindrome\", \"titleSlug\": \"shortest-palindrome\", \"difficulty\": \"Hard\", \"translatedTitle\": \"\\u6700\\u77ed\\u56de\\u6587\\u4e32\"}, {\"title\": \"Repeated Substring Pattern\", \"titleSlug\": \"repeated-substring-pattern\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u91cd\\u590d\\u7684\\u5b50\\u5b57\\u7b26\\u4e32\"}]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"599K\", \"totalSubmission\": \"1.5M\", \"totalAcceptedRaw\": 599048, \"totalSubmissionRaw\": 1492717, \"acRate\": \"40.1%\"}",
|
||||
"stats": "{\"totalAccepted\": \"601.1K\", \"totalSubmission\": \"1.5M\", \"totalAcceptedRaw\": 601051, \"totalSubmissionRaw\": 1497969, \"acRate\": \"40.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
|
Reference in New Issue
Block a user