Skip to content

Commit cfe7448

Browse files
committed
[update] LeetCode 46. Permutations 添加注释
1 parent 975d73e commit cfe7448

File tree

1 file changed

+7
-4
lines changed
  • algorithms-leetcode/src/main/java/com/brianway/learning/algorithms/leetcode/medium

1 file changed

+7
-4
lines changed

algorithms-leetcode/src/main/java/com/brianway/learning/algorithms/leetcode/medium/Permutations.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public List<List<Integer>> permute(int[] nums) {
1919
return null;
2020
}
2121

22+
/**
23+
* 回溯
24+
*/
2225
public class Permutations0 extends Permutations {
2326
@Override
2427
public List<List<Integer>> permute(int[] nums) {
@@ -33,10 +36,10 @@ public List<List<Integer>> permute(int[] nums) {
3336
}
3437

3538
/**
36-
* @param result
37-
* @param path
38-
* @param nums
39-
* @param start
39+
* @param result 所有排列
40+
* @param path 已经被安置在当前排列的数字
41+
* @param nums 使用List是为了使用Collections.swap的API
42+
* @param start 当前从数组哪个位置开始是未使用过的数字
4043
*/
4144
public void backtracking(List<List<Integer>> result, LinkedList<Integer> path, List<Integer> nums, int start) {
4245
if (start == nums.size()) {

0 commit comments

Comments
 (0)