daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 17th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. possibilities = %w(wed thur fri)
  2.  
  3. (1..possibilities.size).reduce([]) do |accumulator, count|
  4.   accumulator + possibilities.combination(count).to_a
  5. end
  6.  
  7. #  => [["wed"], ["thur"], ["fri"], ["wed", "thur"], ["wed", "fri"], ["thur", "fri"], ["wed", "thur", "fri"]]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top