mercredi 3 mai 2017

How to know there are several the possibilities of combination in array in ruby

I have an array @ary = [1, 3, 4, 2, 7, 8, 9] and I want to know how many possibilities of combination can add equal to 9.

I have four possibilities can add equal to 9 [1,8][2, 3, 4][9][2, 7],how can I print it out?




Aucun commentaire:

Enregistrer un commentaire