Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- possibilities = %w(wed thur fri)
- (1..possibilities.size).reduce([]) do |accumulator, count|
- accumulator + possibilities.combination(count).to_a
- end
- # => [["wed"], ["thur"], ["fri"], ["wed", "thur"], ["wed", "fri"], ["thur", "fri"], ["wed", "thur", "fri"]]
Add Comment
Please, Sign In to add comment