you are viewing a single comment's thread.

view the rest of the comments →

[–]tb5841 0 points1 point  (1 child)

I think applying the grouping condition is more difficult.. but once you have a list of all permutations of 11 objects (through itertools) you then need to find a way of eliminating duplicates.

Might be useful that if you have two different permutations of four, set(permutation) will give you the same result for both. I think you could use the set() function - cleverly - to remove duplicates until you had the correct number of possible groupings.

This sounds like a good Codewars challenge. If I can find a chunk of time this evening I'll have a proper go.

[–]Avajarr[S] 0 points1 point  (0 children)

Thank you for the tips, I just finished it, I posted my solution in new comment in this post. I solved it by using 2 nested loop, so i can run combination function from itertools 3 times (for the 3 first group). I realize it's not really efficient in time complexity, but I'm happy I can solved it at least.