def findSubsequences(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ def dfs(nums, path, res): if len(path) > 1: res.append(path) if len(nums) == 0: return for i in range(len(nums)): if i > 0 and nums[i] == nums[i-1]: continue if (len(path) > 0 and path[-1] <= nums[i]) or len(path) == 0: dfs(nums[i+1:], path+[nums[i]], res) res =  dfs(nums, , res) return res
I noticed that you are trying to avoid duplicates by checking nums[i] == nums[i - 1] and skipping the loop if true. This only works if the array is sorted, which isn't always true for this problem. It is much easier to use a set instead to solve this problem :)
@simonzhu91 Exactly! For this problem, I need to check all previous numbers handling duplicates not only just one. Using set also save time. Thank you!