Skip to content

Commit 1f5408b

Browse files
2 parents bf72549 + 13e6ae3 commit 1f5408b

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

problems/0090.子集II.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,30 @@ Python:
211211

212212

213213
Go:
214+
```Go
215+
var res[][]int
216+
func subsetsWithDup(nums []int)[][]int {
217+
res=make([][]int,0)
218+
sort.Ints(nums)
219+
dfs([]int{},nums,0)
220+
return res
221+
}
214222

223+
func dfs(temp, num []int, start int) {
224+
tmp:=make([]int,len(temp))
225+
copy(tmp,temp)
226+
227+
res=append(res,tmp)
228+
for i:=start;i<len(num);i++{
229+
if i>start&&num[i]==num[i-1]{
230+
continue
231+
}
232+
temp=append(temp,num[i])
233+
dfs(temp,num,i+1)
234+
temp=temp[:len(temp)-1]
235+
}
236+
}
237+
```
215238

216239

217240

problems/0226.翻转二叉树.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Java:
207207

208208
Python:
209209

210-
210+
Go:
211211
```Go
212212
func invertTree(root *TreeNode) *TreeNode {
213213
if root ==nil{

0 commit comments

Comments
 (0)