8000
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 4c6d32f commit e8e1847Copy full SHA for e8e1847
algorithms/cpp/nextPermutation/nextPermutation.cpp
@@ -33,11 +33,11 @@
33
* 2 1 3 4
34
* ...
35
*
36
- * The pattern as below:
+ * The pattern can be descripted as below:
37
38
- * 1) find the first place which num[i-1] < num[i]
39
- * 2) find the first number from n-1 to i which >= num[i-1]
40
- * 3) swap the 2) num with num[i-1]
+ * 1) from n-1 to 0, find the first place [i-1] which num[i-1] < num[i]
+ * 2) from n-1 to i, find the first number from n-1 to i which >= num[i-1]
+ * 3) swap the 2) num with the num[i-1]
41
* 4) sort the sub-array [i, n) //actuall sort is fine as well
42
43
* For example:
0 commit comments