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 ad11b79 commit 3cf1881Copy full SHA for 3cf1881
permutations-ii/README.md
@@ -1,4 +1,23 @@
1
+## Variant of [Next Permutation](../next-permutation)
2
-## TODO
3
- * write down thinking
+With the help of [Next Permutation](../next-permutation), you can find all unique permutations from the first permutation.
4
5
+### First and Last
6
+
7
+ * First permutation is the numbers in non-descending order
8
+ * Last permutation is the numbers in non-ascending order
9
10
11
+so the code is like
12
13
+```
14
+sort(num) // make it the first
15
16
17
+while num is not the last
18
+ call nextPermutation(num)
19
20
+ copy num into result
21
22
23
0 commit comments