From ba4bb85a92dfe611d71502123b9c91dbbdfd9ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Mon, 24 Feb 2014 03:31:13 -0800 Subject: [PATCH] --- Array combinations | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Array combinations b/Array combinations index 65fe445..a265ab2 100644 --- a/Array combinations +++ b/Array combinations @@ -1,10 +1,11 @@ def array_combinations(*args): - combinations = [[i] for i in args[0]] + combinations = [[i] for i in set(args[0])] for arg in args[1:]: tempcomb = [] - for i in arg: + for i in set(arg): tempcomb += [c+[i] for c in combinations if i not in c ] combinations = tempcomb return combinations res = array_combinations(a,b,c) +print res print len(res) \ No newline at end of file