hi i am not able to the question using string builder.
can anyone send me a code where they hava used string builder concept
hi i am not able to the question using string builder.
can anyone send me a code where they hava used string builder concept
Hey @VinayakSingh11111
public static void printpermutationSB(String str, StringBuilder ans) {
if (str.length() == 0) {
System.out.print(ans+" ");
count++;
return;
}
for (int i = 0; i < str.length(); i++) {
printpermutationSB(str.substring(0, i) + str.substring(i + 1), ans.append(str.charAt(i)));
ans.delete(ans.length()-1, str.charAt(i));
}
}
Dry run this code