Question: Java code please /** * Write a recursive function that finds the index of s2 in s1. Do not use any * string functions except
Java code please
/** * Write a recursive function that finds the index of s2 in s1. Do not use any * string functions except for .length(), .equals(), and .substring(). Do not use * any loops, or any data structures. * @param s1 * @param s2 * @return Returns the index of the first time that * s2 appears in s1 or -1 if s2 is not contained * in s1. */ public static int indexOf(String s1, String s2) {}
sample outputs System.out.println(Recursion.indexOf("Hello", "lo")); // 3 Stack
Should use only static methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
