Increasing Subsequences LeetCode solution in Python
1# Runtime: 750 ms (Top 10.08%) | Memory: 22.4 MB (Top 30.72%)2class Solution:3def findSubsequences(self, nums: List[int]) -> List[List[int]]:4def backtracking(nums, path):5# to ensure that the base array has at least 2 elements6if len(path) >= 2:7res.add(tuple(path))8for i in range(len(nums)):9# to ensure that every element to be added is equal or larger than the former10if not path or path[-1] <= nums[i]:11backtracking(nums[i + 1 :], path + [nums[i]])1213res = set()14backtracking(nums, [])15return res