We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 57ed447 commit 1bb85ffCopy full SHA for 1bb85ff
src/main/java/com/fishercoder/solutions/_28.java
@@ -23,12 +23,13 @@ public int strStr(String haystack, String needle) {
23
int n = needle.length();
24
int h = haystack.length();
25
26
- for(int i = 0; i <= h - n; i++) {
27
- for(int j = 0; j < n && haystack.charAt(i + j) == needle.charAt(j); j++) {
28
- if(j == n - 1) return i;
+ for (int i = 0; i <= h - n; i++) {
+ for (int j = 0; j < n && haystack.charAt(i + j) == needle.charAt(j); j++) {
+ if (j == n - 1) {
29
+ return i;
30
+ }
31
}
32
-
33
return -1;
34
35
0 commit comments