Question: Given a String x, a substring m from x and a number n, write a recursive method (no loops) to check if at least n
Given a String x, a substring m from x and a number n, write a recursive method (no loops) to check if at least n copies of the substring m appear in the String x. You should call your method checkForSub. checkForSub should take in 2 Strings and an Integer value and return a Boolean.
For Example:
checkForSub("catcowcat", "cat", 2) -> true
checkForSub("catcowcat", "cow", 2) -> false
checkForSub("catcowcat", "cow", 1) -> true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
