diff --git a/problems/0491.递增子序列.md b/problems/0491.递增子序列.md index 85c9d307..103b8b10 100644 --- a/problems/0491.递增子序列.md +++ b/problems/0491.递增子序列.md @@ -257,6 +257,34 @@ class Solution: Go: +```golang +func findSubsequences(nums []int) [][]int { + var subRes []int + var res [][]int + backTring(0,nums,subRes,&res) + return res +} +func backTring(startIndex int,nums,subRes []int,res *[][]int){ + if len(subRes)>1{ + tmp:=make([]int,len(subRes)) + copy(tmp,subRes) + *res=append(*res,tmp) + } + history:=[201]int{}//记录本层元素使用记录 + for i:=startIndex;i0&&nums[i]