I have an associative array in ruby which I want to convert into a hash. This hash will represent the first values as key and sum of their second values as its value.
x = [[1,2],[1,3],[0,1],[0,2],[0,3],[1,5],[0,4],[1,6],[0,9],[1,9]]
How can I get a hash like the following from this associative array?
{
:0 => <sum_of_second_values_with_0_as_first_values>,
:1 => <sum_of_second_values_with_1_as_first_values>
}