[简单]28. 实现 strStr()

https://leetcode-cn.com/problems/implement-strstr/

 

 

能不动脑子为什么要折腾呢?

class Solution {
    public int strStr(String haystack, String needle) {
        if(needle.length() == 0) return 0;
        return haystack.indexOf(needle);

    }
}

 

posted @ 2022-04-03 15:27  v大喵  阅读(11)  评论(0编辑  收藏  举报