Movatterモバイル変換


[0]ホーム

URL:


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

Commitad11b79

Browse files
committed
change to list
1 parente88daad commitad11b79

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎permutations-ii/Solution.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
publicclassSolution {
2+
23
voidswap(intx[],inta,intb) {
34
intt =x[a];
45
x[a] =x[b];
@@ -37,19 +38,18 @@ public boolean nextPermutation(int[] num) {
3738
returntrue;
3839
}
3940

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

4546
returnl;
4647
}
4748

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

52-
ArrayList<ArrayList<Integer>>found =newArrayList<ArrayList<Integer>>();
52+
ArrayList<List<Integer>>found =newArrayList<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
returnfound;
6060
}
61-
}
61+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp