Skip to content

Sub Sets#29

Open
rossy0213 wants to merge 1 commit intomainfrom
leetcode-subsets
Open

Sub Sets#29
rossy0213 wants to merge 1 commit intomainfrom
leetcode-subsets

Conversation

@rossy0213
Copy link
Copy Markdown
Owner

@@ -0,0 +1,19 @@
```java
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これも再帰の仕方が何種類かあるように思います。あとループに直せるといいと思います。

return res;
}

private void backtrack(List<List<Integer>> res, List<Integer> tempList, int[] nums, int start) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tempList が気になってしまいました。
backtrack() を呼ぶごとに1つの組み合わせとして res に add() しているので、subset とかでもいいかもしれません。
と、すみません backtrack() も気になりました。
makeSubsets() とか、何かしら付けるといいかもしれません。

Copy link
Copy Markdown

@fhiyo fhiyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いいと思います。別解がもう少しあるといいかもしれません。
あとstep3で変化がない場合は1つにまとめる方がレビュワー (や後でご自身が読み返すとき) の負担が減りそうです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants