Question: Convert the following iterative method into a recursive method: // Prints each character of the string reversed twice. // doubleReverse (hello) prints oolllleehh public static
Convert the following iterative method into a recursive method:
= 0; i--) { System.out.print (s.charAt (i)); System.out.print (s.charAt (i));" class="fr-fic fr-dib" width="578" height="290">
// Prints each character of the string reversed twice. // doubleReverse ("hello") prints oolllleehh public static void doubleReverse (String s) { for (int i = s.length () 1; i >= 0; i--) { System.out.print (s.charAt (i)); System.out.print (s.charAt (i));
Step by Step Solution
3.57 Rating (171 Votes )
There are 3 Steps involved in it
Recursive version of doubleReverse method ... View full answer
Get step-by-step solutions from verified subject matter experts
