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