This commit is contained in:
youngyangyang04
2021-05-13 22:49:32 +08:00
2 changed files with 24 additions and 1 deletions

View File

@ -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]
}
}
```

View File

@ -207,7 +207,7 @@ Java
Python
Go
```Go
func invertTree(root *TreeNode) *TreeNode {
if root ==nil{