You are on page 1of 1

def subsets(arr,nums,n,ind):

if ind < n:
for i in range(ind,n):
subsets(arr+[nums[i]],nums,n,i+1)
print(arr)

t=int(input())
l=[0]*11
n=len(l)
top1=-1
top2= n
for i in range(t):
s=input().split()

if s[0]=="push1":
x=int(s[-1])
if top1 < top2-1:
top1+=1
l[top1]=x
else:
print("Full hi")

elif s[0]=="push2":
x=int(s[-1])
if top1 < top2-1:
top2-=1
l[top2]=x
else:
print("full hello")

elif s[0]=="pop1":
if top1>=0:
print(l[top1])
top1-=1
else:
print("Empty hi")

elif s[0]=="pop2":
if top2<n:
print([top2])
top2+=1
else:
print("empty hello")
print(l)

def subsets(nums):
res = []
backtrack(res, [], nums, 0)
return res

def backtrack(res, temp, nums, start):


res.append(sum(temp[:]))
for i in range(start, len(nums)):
temp.append(nums[i])
backtrack(res, temp, nums, i + 1)
temp.pop()

You might also like