File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
public class Solution {
2
+
2
3
void swap (int x [], int a , int b ) {
3
4
int t = x [a ];
4
5
x [a ] = x [b ];
@@ -37,19 +38,18 @@ public boolean nextPermutation(int[] num) {
37
38
return true ;
38
39
}
39
40
40
- ArrayList <Integer > asList (int [] num ){
41
+ List <Integer > asList (int [] num ){
41
42
ArrayList <Integer > l = new ArrayList <Integer >(num .length );
42
43
for (int i = 0 ; i < num .length ; i ++)
43
44
l .add (num [i ]);
44
45
45
46
return l ;
46
47
}
47
48
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 ) {
50
50
Arrays .sort (num );
51
51
52
- ArrayList <ArrayList <Integer >> found = new ArrayList <ArrayList <Integer >>();
52
+ ArrayList <List <Integer >> found = new ArrayList <List <Integer >>();
53
53
found .add (asList (num ));
54
54
55
55
while (nextPermutation (num )){
@@ -58,4 +58,4 @@ public ArrayList<ArrayList<Integer>> permuteUnique(int[] num) {
58
58
59
59
return found ;
60
60
}
61
- }
61
+ }
You can’t perform that action at this time.
0 commit comments