r = ->(a){(1..a.size).flat_map{|n|a.sort.combination(n).select{|c|c.reduce(:+)==10}.uniq}} p r.([5, 2, 3, 5])
Standard input is empty
[[5, 5], [2, 3, 5]]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!