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

Commitc7a2647

Browse files
committed
subset
1 parent31915c8 commitc7a2647

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

‎dfs/Subsets.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,10 @@ public List<List<Integer>> subsets(int[] S) {
2020
}
2121

2222
publicvoidsubsets(int[]S,List<Integer>path,List<List<Integer>>ret,intindex) {
23-
intlen =S.length;
24-
2523
// 把当前的结果可以添加到结果集中. 空集也算是一种集合
2624
ret.add(newArrayList<Integer>(path));
2725

28-
if (index >=len) {
29-
return;
30-
}
31-
32-
for (inti =index;i <len;i++) {
26+
for (inti =index;i <S.length;i++) {
3327
path.add(S[i]);
3428

3529
// 注意!这里的index要填写i + 1,而不是index,开始老是会犯错。

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp