Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 91f4c60

Browse files
author
C5141506
committed
Leetcode problems
1 parent 9ca291e commit 91f4c60

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/main/problems/java_problem/dynamic_programming/NumberPermutation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
public class NumberPermutation {
66
public static void main(String[] args) {
7-
int[] nums = {1, 2, 3};
7+
int[] nums = {1, 2, 1};
88
System.out.println(checkInclusion(nums));
99
}
1010

@@ -18,7 +18,7 @@ public static List<List<Integer>> checkInclusion(int[] nums) {
1818
}
1919

2020
public static List<List<Integer>> findPermutation(int totalPermutation, List<Integer> ls) {
21-
List<List<Integer>> permutations = new ArrayList<>();
21+
Set<List<Integer>> permutations = new HashSet<>();
2222
for (int i = 0; i < totalPermutation; i++) {
2323
List<Integer> numbers = new ArrayList<Integer>(ls);
2424
int dividend = i;
@@ -32,7 +32,7 @@ public static List<List<Integer>> findPermutation(int totalPermutation, List<Int
3232
}
3333
permutations.add(permutation);
3434
}
35-
return permutations;
35+
return newArrayList<>(permutations);
3636
}
3737

3838
public static int fact(int n) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /