We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 470ce54 commit 4803cd4Copy full SHA for 4803cd4
String/permutationRecursion
@@ -0,0 +1,26 @@
1
+// Online C++ compiler to run C++ program online
2
+#include <iostream>
3
+using namespace std;
4
+
5
+void permute(string str, int l, int r)
6
+{
7
8
+ if (l == r)
9
+ cout << str << endl;
10
+ else
11
+ {
12
+ for (int i = l; i <= r; i++)
13
14
+ swap(str[l], str[i]);
15
+ permute(str, l + 1, r);
16
17
+ }
18
19
+}
20
21
+int main() {
22
+ int l = 0, r = 2;
23
+ permute("abc", l, r);
24
25
+ return 0;
26
0 commit comments