diff --git a/solutions/46. Permutations.md b/solutions/46. Permutations.md index 9eaecc3..087f710 100644 --- a/solutions/46. Permutations.md +++ b/solutions/46. Permutations.md @@ -2,7 +2,7 @@ # 思路 返回一个数组的所有排列,数组中元素没有重复。 ## 思路一、Next Permutation -如果做了[31. Next Permutation](https://leetcode.com/problems/next-permutation/)的话那这题就没什么问题了。稍有不同的是此题的数组元素没有重复而39题中可能重复。 +如果做了[31. Next Permutation](https://leetcode.com/problems/next-permutation/)的话那这题就没什么问题了。稍有不同的是此题的数组元素没有重复而31题中可能重复。 所以此题可以使用STL中现成的next_permutation函数: > bool next_permutation (first, last)返回的是bool型,如果已经是最后一个排列了则返回false并将数组变成第一个排列(即按照从小到大排好序);否则返回true并将数组变成下一个排列。 此外还可以传入comp参数: next_permutation (first, last, comp)这样就可以自定义数组的大小规则。