You can build a backtracking based solution to formulate all the possible sub-sequence for the given array. Sharing an ideone link for the same: https://ideone.com/V0gCDX
all = []
def gen(A, idx = 0, cur = []):
if idx >= len(A):
if len(cur): all.append(cur)
return
gen(A, idx + 1, list(cur))
incl = list(cur)
incl.append(A[idx])
gen(A, idx + 1, incl)
def solve(A):
global all
all = []
gen(A)
return all
print(solve([1, 4, 6]))
0
solved Algorithm for all subsets of Array