第九周作业1
程序员文章站
2022-07-12 13:46:32
...
// A code block
func subsets(nums []int) [][]int {
result := [][]int{}
result = append(result, []int{}) for i:= 0; i < len(nums) ; i ++ {
newSets := [][]int{}
for _,set := range result {
setCopy := make([]int, len(set))
copy(setCopy, set)
setCopy = append(setCopy, nums[i])
newSets = append(newSets, setCopy)
} result = append(result, newSets...) }
return result
}
上一篇: 运维人员的军刀——ROS
下一篇: 第九周作业2