What\'s the efficient way to multiply two arrays and get sum of multiply values in Ruby? I have two arrays in Ruby:
array_A = [1, 2, 1, 4, 5, 3, 2, 6, 5, 8, 9] a
This is another way:
array_A.zip(array_B).inject(0) {|r, (a, b)| r + (a * b)}