I have to return the subsets of the given array, I know the logic that while recurring we have to first include elements than backtrack and then exclude elements of the given array. But while implementing in python, I don't know what is going wrong, the return list is not containing anything
class Solution: def subsets(self, A): def sub(i, A, lis, ans): if i==len(A): ans.append(lis) return lis.append(A[i]) sub(i+1, A, lis, ans) lis.remove(A[i]) sub(i+1, A, lis, ans) ans = [] lis = [] n = len(A) sub(0, A, lis, ans) return ans