Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This solution uses Ruby's combination method to generate all possible combinations of 2 elements from the input array. It then adds the sum of each combination to a hash, with the sum as the key and a value of true. If the sum is even, it will be added to the hash. Since a hash only allows unique keys, the size of the hash at the end will represent the number of distinct even sums.