小白笔记-----------------------leetcode(28. Implement strStr())
2016-12-15 19:29
453 查看
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
这一次用java写的,确实比用c简单了许多。。。代码入下:
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
这一次用java写的,确实比用c简单了许多。。。代码入下:
public class Solution { public int strStr(String haystack, String needle) { if(haystack.contains(needle)){ return haystack.indexOf(needle); }else{ return -1; } } }
相关文章推荐
- LeetCode笔记:28. Implement strStr()
- LeetCode --- 28. Implement strStr()
- 【leetcode】28. Implement strStr()
- LeetCode 28. Implement strStr()
- leetcode 28. Implement strStr()
- 28. Implement strStr()-leetcode-java
- 【LeetCode】28. Implement strStr() (2 solutions)
- 【leetcode】28. Implement strStr()
- Leetcode 28. Implement strStr()
- leetcode 28. Implement strStr()
- leetcode 28. Implement strStr()
- 【LeetCode】28. Implement strStr()
- <LeetCode OJ> 28. Implement strStr()
- [leetcode] 28. Implement strStr() 解题报告
- LeetCode *** 28. Implement strStr()
- [Leetcode] 28. Implement strStr()
- [LeetCode] 28. Implement strStr() 解题思路
- 28. Implement strStr() LeetCode
- 【一天一道LeetCode】#28. Implement strStr()
- Leetcode 28. Implement strStr() KMP算法解题