Respected Members,
hey mine code this one
[code]
import itertools
def checkSet(lis):
flag=True
for i in range(1,len(lis),1):
if(lis.index(lis[i])+1) in lis:
flag=True
else:
flag=False
break
if flag==True:
print(lis)
def findsubsets(S,m):
return set(itertools.combinations(S, m))
def generate(lis):
j=len(lis)
for i in range(1,j+1,1):
data=[]
s=set();
lists=findsubsets(lis, i)
listss=list(lists)
s=list()
flag=True
for k in range(0,len(listss),1):
counter=0
if(len(listss[k])<=1):
continue
else:
d=[]
d=list(listss[k])
checkSet(d)
l=[2,3,4,5,6]
generate([2,3,4])
[/code]
Does this works generates
[2, 3]
[2, 4]
[2, 3, 4]
is right na
--
You received this message because you are subscribed to the Google Groups
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.