Simple Python AC solution

  • 0
    class Solution(object):
        def findSubsequences(self, nums):
            if not nums:
                return []
            res = set()
            return [list(elem) for elem in res]
        def helper(self,nums,start,tmp,res):
            if len(tmp)>=2:
            for i in range(start,len(nums)):
                if not tmp or (i>0 and tmp[-1]<=nums[i]):

    Since lists are unhashable in python, I couldn't get the set of lists( which can be done in Java ). So I made all the sequences as tuples and added them to a set. Returned the resulting set of tuples as a set of lists.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.