1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-05 07:21:40 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

更新国内版力扣题目描述变更

This commit is contained in:
2022-05-02 23:42:43 +08:00
parent 74598d1cf8
commit 7ea03594b3
198 changed files with 11378 additions and 11118 deletions

View File

@@ -1,16 +1,16 @@
<p>实现 <a href="https://baike.baidu.com/item/strstr/811469" target="_blank">strStr()</a> 函数。</p>
<p>实现&nbsp;<a href="https://baike.baidu.com/item/strstr/811469" target="_blank">strStr()</a>&nbsp;函数。</p>
<p>给你两个字符串 <code>haystack</code><code>needle</code> ,请你在 <code>haystack</code> 字符串中找出 <code>needle</code> 字符串出现的第一个位置(下标从 0 开始)。如果不存在,则返回  <code>-1</code><strong> </strong></p>
<p>给你两个字符串&nbsp;<code>haystack</code><code>needle</code> ,请你在 <code>haystack</code> 字符串中找出 <code>needle</code> 字符串出现的第一个位置(下标从 0 开始)。如果不存在,则返回&nbsp; <code>-1</code><strong> </strong></p>
<p> </p>
<p>&nbsp;</p>
<p><strong>说明:</strong></p>
<p> <code>needle</code> 是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。</p>
<p>&nbsp;<code>needle</code>&nbsp;是空字符串时,我们应当返回什么值呢?这是一个在面试中很好的问题。</p>
<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>
<p>对于本题而言,当&nbsp;<code>needle</code>&nbsp;是空字符串时我们应当返回 0 。这与 C 语言的&nbsp;<a href="https://baike.baidu.com/item/strstr/811469" target="_blank">strstr()</a>&nbsp;以及 Java 的&nbsp;<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(java.lang.String)" target="_blank">indexOf()</a>&nbsp;定义相符。</p>
<p> </p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
@@ -33,11 +33,11 @@
<strong>输出:</strong>0
</pre>
<p> </p>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 <= haystack.length, needle.length <= 5 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= haystack.length, needle.length &lt;= 10<sup>4</sup></code></li>
<li><code>haystack</code><code>needle</code> 仅由小写英文字符组成</li>
</ul>