Using Recursion Only public static java.lang.String everyNth(java.lang.String s, int n) Returns a string containing only the characters
Fantastic news! We've Found the answer you've been seeking!
Question:
Using Recursion Only public static java.lang.String everyNth(java.lang.String s, int n)
Returns a string containing only the characters of s whose position in s, counting from 1, is zero mod n. No credit if your solution uses a loop. For instance, given the parameters s = "abcabcabcabca" and n = 3, the output should be "ccc".
Parameters:
s - The input string
n - The position modulus
Returns:
The new string.
Related Book For
Consumer Behavior Buying, Having and Being
ISBN: 978-0133450897
11th edition
Authors: Michael R. Solomon
Posted Date: