Leetcode 28. Implement strStr() (Easy) (cpp)
来源:互联网 发布:禁入证券市场 知乎 编辑:程序博客网 时间:2024/05/23 14:44
Leetcode 28. Implement strStr() (Easy) (cpp)
Tag: Two Pointers, String
Difficulty: Easy
/*28. Implement strStr() (Easy)Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.*/class Solution {public:int strStr(string haystack, string needle) {int haylen = haystack.length(), neelen = needle.length();for (int i = 0, j; i <= haylen - neelen; i++) {for (j = 0; j < neelen && haystack[i + j] == needle[j]; j++) { } if (j == neelen) return i; } return -1; }};
0 0
- Leetcode 28. Implement strStr() (Easy) (cpp)
- Leetcode[easy] - Implement strStr()
- 28. Implement strStr() [easy]
- 【Easy】28. Implement strStr()
- LeetCode-Easy-Java-Implement strStr()
- 28. Implement strStr() [easy] (Python)
- [LeetCode] 028. Implement strStr() (Easy) (C++/Python)
- LeetCode-28-Implement strStr()(Sting/穷举)-Easy
- LeetCode OJ 28 Implement strStr() [Easy]
- LeetCode-Easy刷题(9) Implement strStr()
- [LeetCode]28.Implement strStr()
- LeetCode --- 28. Implement strStr()
- LeetCode 28.Implement strStr()
- [Leetcode] 28. Implement strStr()
- 【leetcode】28. Implement strStr()
- [leetcode] 28.Implement strStr()
- Leetcode-28.Implement strStr()
- 28. Implement strStr() LeetCode
- JZOJ1758. 过河
- Hadoop文件系统元数据fsimage和编辑日志edits
- Java集合List、Set和Map的区别
- CoordinatorLayout协调布局,实现悬浮导航条
- java 知识点总结4
- Leetcode 28. Implement strStr() (Easy) (cpp)
- 正则表达式入门教程
- 移动坐标
- UGUI工厂
- python-字符串知识点
- Java并发编程:进程和线程之由来
- hdu 5367(线段树+区间合并)
- ASCII字符表
- Js random随机生成正整数