Page 1 of 1

How many times is the function wordScramble() called in the given program? public class WordScramble { public static

Posted: Sat May 14, 2022 3:21 pm
by answerhappygod
How many times is the function wordScramble() called in
the given program?
public class WordScramble {
public static void wordScrarnble(String rem, String
scr) {
if (rem.isEmpty()) {
System.out.println(scr + rem);
} else {

for (int i= O; i < rem.length(); ++i)
{
wordScrarnble((rem.substring(O,
i) + rem.substring(i + 1, rem.length())), (scr +
rem.charAt(i)));
}
}
}
public static void main(String args[]) {
wordScramble ( "ab" ," " ) ;
}
}