0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| class Solution: def findSubsequences(self, nums: List[int]) -> List[List[int]]: path,result = [],[] def split_tree(nums,start_index) -> List[List[int]]: print(path) if len(path)>=2: result.append(path.copy()) used = set() for i in range(start_index,len(nums)): if (nums[i] in used) or (path!=[] and (nums[i]<path[-1])): continue used.add(nums[i])
path.append(nums[i]) split_tree(nums,i+1) path.pop() return result return split_tree(nums,0)
|