Prefix Sum in Ruby, Genomic Range Query from Codility
Some notes:


Use 2-space indentation.
[[0,0,0,0]]. Always a space after a comma.
str.split('') - >str.chars
prefix_sums = [[0,0,0,0]]. This kind of implicit structures hinder readability, I'd simply use a hash. A small space penalty (not in big-Oh, though), better readibility.
each_with_index. Use zip instead.
As you say, the problem is about getting partial sums (frequencies). You can implement and use a very generic abstraction (Enumerable#scanl), which can be used in more codility problems.


I'd write this purely functional solution:

def solution(input_str, slice_start, slice_end)
  impact_factors = {"A" =&gt; 1, "C" =&gt; 2, "G" =&gt; 3, "T" =&gt; 4}
  frequencies = input_str.chars.scanl(Hash.new(0)) do |freq, n|
    freq.merge(n =&gt; freq[n] + 1)
  end

  slice_start.zip(slice_end).map do |from, to|
    difference_count_by_factor = frequencies[to+1].map do |n, count| 
      [impact_factors[n], count - frequencies[from][nucleotide]]
    end.to_h
    difference_count_by_factor.reject { |factor, count| count.zero? }.keys.min
  end
end