一、题目叙述:
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Subscribe to see which companies asked this question
二、解题思路:
哈哈哈哈。。。改天重写。
三、源码:
public class Solution
{
public int strStr(String haystack, String needle)
{
return haystack.indexOf(needle);
}
public static void main(String args[])
{
String hay = "";
String need = "3";
Solution so = new Solution();
System.out.println(so.strStr(hay, need));
}
}