Skip to content

Commit 4be202f

Browse files
committed
refine the comments
1 parent 04c5eef commit 4be202f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

algorithms/cpp/nextPermutation/nextPermutation.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
* 2 1 3 4
3434
* ...
3535
*
36-
* The pattern as below:
36+
* The pattern can be descripted as below:
3737
*
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]
38+
* 1) from n-1 to 0, find the first place [i-1] which num[i-1] < num[i]
39+
* 2) from n-1 to i, find the first number from n-1 to i which >= num[i-1]
40+
* 3) swap the 2) num with the num[i-1]
4141
* 4) sort the sub-array [i, n) //actuall sort is fine as well
4242
*
4343
* For example:

0 commit comments

Comments
 (0)