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 X="" and Y="", return true; (but this condition is not needed)
if (X.length() <= 1) { // if length of X is 1, then it is not equal to Y as if it was equal then previous if statement would return true
return false;
}
int n = X.length();
int flag = false;
for (int i = 1; i <= n - 1; i++) { // Note :- We can't into empty substring
if ((Solve(X.substr(0, i), Y.substr(n - i, i)) && Solve(X.substr(i, n-i), Y.substr(0, n - i))) || // these are two condition for swapping and not swapping the string