Print All Permutations of a String
Print all permutations of a given string.
We'll cover the following...
Statement
Given a string, print all possible permutations of the string.
Example
All permutations of string “bad” are:
Sample input
"bad"
Expected output
["bad", "bda", "abd", "adb", "dab", "dba"]
Try it yourself
Note: The order in which the permutations are generated or returned does not affect the correctness of the solution.
#include <iostream>#include <vector>#include <string>using namespace std;vector<string> PermuteString(string input) {vector<string> output;//TODO: Write - Your - Codereturn output;}
Solution
Let’s discuss a few basics first. We know that ...