28. Implement strStr()

来源:互联网 发布:linux 守护进程脚本 编辑:程序博客网 时间:2024/06/18 14:47

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) {        int x = haystack.indexOf(needle);        return x;    }}

0 0