leetcode卡-strStr:字符串

时间:2021-07-06 20:52:24
【文件属性】:
文件名称:leetcode卡-strStr:字符串
文件大小:8KB
文件格式:ZIP
更新时间:2021-07-06 20:52:24
系统开源 leetcode卡字符串 实现 strStr()。 返回 haystack 中第一次出现针的索引,如果针不是 haystack 的一部分,则返回 -1。 澄清: 当针为空字符串时,我们应该返回什么? 这是面试时要问的一个很好的问题。 为了解决这个问题,当needle为空字符串时,我们将返回0。 这与 C 的 strstr() 和 Java 的 indexOf() 一致。 示例 1: 输入:haystack = "hello",needle = "ll" 输出:2 示例 2: 输入:haystack = "aaaaa",needle = "bba" 输出:-1 示例 3: 输入:haystack = "",needle = "" 输出:0 约束: 0 <= haystack.length,needle.length <= 5 * 104 haystack 和needle 仅由小写英文字符组成。
【文件预览】:
strStr-master
----strStr.sln(1KB)
----strStr()
--------Program.cs(759B)
--------strStr.csproj(2KB)
--------App.config(182B)
--------Properties()
----.gitignore(6KB)
----README.md(798B)
----.gitattributes(2KB)

网友评论