You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (givenString.length() == 0) // If string is empty we will create an array of size=1 and insert "" (Empty string) in it
{
String[] ans = newString[1];
ans[0] = "";
returnans;
}
String[] SmallAns = returnSubsequence(givenString.substring(1)); //recursive call to get subsequences of substring starting from index position=1
String[] ans = newString[2 * SmallAns.length];// Our answer will be an array off string of size=2*SmallAns
inti = 0;
for (; i < SmallAns.length; i++) {
ans[i] = SmallAns[i]; //Copying all the strings present in SmallAns to ans string array
}
for (intk = 0; k < SmallAns.length; k++) {
ans[k + SmallAns.length] = givenString.charAt(0) + SmallAns[k]; // Insert character at index=0 of the given substring in front of every string in SmallAns