Skip to content

Commit ad11b79

Browse files
committed
change to list
1 parent e88daad commit ad11b79

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

permutations-ii/Solution.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
public class Solution {
2+
23
void swap(int x[], int a, int b) {
34
int t = x[a];
45
x[a] = x[b];
@@ -37,19 +38,18 @@ public boolean nextPermutation(int[] num) {
3738
return true;
3839
}
3940

40-
ArrayList<Integer> asList(int[] num){
41+
List<Integer> asList(int[] num){
4142
ArrayList<Integer> l = new ArrayList<Integer>(num.length);
4243
for(int i = 0; i < num.length; i++)
4344
l.add(num[i]);
4445

4546
return l;
4647
}
4748

48-
public ArrayList<ArrayList<Integer>> permuteUnique(int[] num) {
49-
// Note: The Solution object is instantiated only once and is reused by each test case.
49+
public List<List<Integer>> permuteUnique(int[] num) {
5050
Arrays.sort(num);
5151

52-
ArrayList<ArrayList<Integer>> found = new ArrayList<ArrayList<Integer>>();
52+
ArrayList<List<Integer>> found = new ArrayList<List<Integer>>();
5353
found.add(asList(num));
5454

5555
while(nextPermutation(num)){
@@ -58,4 +58,4 @@ public ArrayList<ArrayList<Integer>> permuteUnique(int[] num) {
5858

5959
return found;
6060
}
61-
}
61+
}

0 commit comments

Comments
 (0)