fork(4) download
  1. r = ->(a){(1..a.size).flat_map{|n|a.sort.combination(n).select{|c|c.reduce(:+)==10}.uniq}}
  2.  
  3. p r.([5, 2, 3, 5])
Success #stdin #stdout 0.02s 9784KB
stdin
Standard input is empty
stdout
[[5, 5], [2, 3, 5]]