Skip to content

Commit

Permalink
Merge pull request youngyangyang04#75 from QuinnDK/添加0090子集IIGo版本-1
Browse files Browse the repository at this point in the history
添加0090子集IIGo版本
  • Loading branch information
youngyangyang04 committed May 13, 2021
2 parents b3168d0 + 3ca406d commit f233316
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions problems/0090.子集II.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,30 @@ Python:


Go:
```Go
var res[][]int
func subsetsWithDup(nums []int)[][]int {
res=make([][]int,0)
sort.Ints(nums)
dfs([]int{},nums,0)
return res
}

func dfs(temp, num []int, start int) {
tmp:=make([]int,len(temp))
copy(tmp,temp)

res=append(res,tmp)
for i:=start;i<len(num);i++{
if i>start&&num[i]==num[i-1]{
continue
}
temp=append(temp,num[i])
dfs(temp,num,i+1)
temp=temp[:len(temp)-1]
}
}
```



Expand Down

0 comments on commit f233316

Please sign in to comment.