Given an array ['a', 'b', 'c', 'd', 'e', 'f']
, how would I get a list of all subsets containing two, three, and four elements?
I'm quite new to Ruby (moving from C#) and am not sure what the 'Ruby Way' would be.
Given an array ['a', 'b', 'c', 'd', 'e', 'f']
, how would I get a list of all subsets containing two, three, and four elements?
I'm quite new to Ruby (moving from C#) and am not sure what the 'Ruby Way' would be.
Tweaking basicxman's a little bit:
Check out Array#combination
Then something like this: