您的位置:首页 > 其它

leetcode Implement strStr()

2015-06-08 10:00 225 查看
题目链接这里

public class Solution {
public int strStr(String haystack, String needle) {
out:for(int i=0;i<haystack.length()-needle.length()+1;i++)
{
for(int j=0;j<needle.length();j++)
{
if(haystack.charAt(i+j)!=needle.charAt(j))
{
continue out;
}
}
return i;
}
return -1;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: