Write a recursive method called indexOf that accepts two strings as parameters and returns the starting index of the first occurrence of the second string inside the first string (or -1 if not found).
Recursion
Find a substring
Report a typo
Sample Input 1:
Java
JSample Output 1:
0Sample Input 2:
Hyper
ErSample Output 2:
-1Write a program in Java 17
class Util {
public static int indexOf(String src, String tgt) {
// your code here
return -1;
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.