前言LeetCode答案,语言Java 问题 https://leetcode-cn.com/problems/implement-strstr/ 源代码1234567891011121314import java.util.Arrays;class Solution { public int strStr(String haystack, String needle) { for (int i = 0; i < haystack.length()-(needle.length()-1); i++) { if (needle.equals(haystack.substring(i, i+needle.length()))) { return i; } } return -1; }} 完成